Forms

Color picker

@xui/color-picker

A color picker — the swatch trigger opens a panel with a saturation/value square, hue slider, optional alpha slider, a channel input row and preset swatches. value is a two-way bindable hex string; the input row switches between HEX, HSL and LCH via the format selector.

Install

pnpm add @xui/color-picker

Add the barrel to a standalone component's imports:

import { XuiColorPickerImports } from '@xui/color-picker';

@Component({
  imports: [XuiColorPickerImports],
  // …
})

Examples

Basic

Loading preview…

With alpha

Loading preview…

Input formats

Loading preview…

API

XuiColorPicker

componentxui-color-picker

A color picker: a swatch trigger opens a panel with a saturation/value square, a hue slider, an optional alpha slider, a hex field and preset swatches. value is a two-way bindable hex string (#RRGGBB / #RRGGBBAA).

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''valuetwo-waystringThe selected colour as a hex string — #RRGGBB, or #RRGGBBAA when showAlpha is on. Two-way bindable with [(value)].'#1677FF'showAlphabooleanAdd an opacity slider and carry the alpha channel in value.falsedisabledbooleanBlock interaction and dim the trigger. The panel cannot be opened.falsepresetsstring[]Hex colours offered as one-click swatches under the picker. Empty hides the row.[]formattwo-wayXuiColorFormatWhich channel model the input row edits: hex, hsl or lch. Two-way bindable.'hex'

Source

libs/ui/color-picker/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.