Skip to main content

Starwind UI v2.0 is now available! With new color-picker and more components

Color Picker

Installation

Usage

General Notes

ColorPicker uses a hidden native color input trigger and a custom floating picker panel for selecting hue, saturation, and opacity. It supports HEX/RGB/HSL/HSB formatting in the panel and emits a custom change event when values update.

Sizes

Use the size prop to switch between "sm", "md", and "lg" variants.

Small

Medium (Default)

Large

Default Value

Pass defaultValue as a hex color string to initialize the picker with a specific color.

Programmatic Set Value

Call the element’s setValue method with rgb(r,g,b) or rgba(r,g,b,a) to update the picker programmatically.

Tip

Open the browser console and click the button to see the emitted value from the starwind-color-picker:change event.

Custom Use

Because ColorPicker renders as a compact interactive control, you can compose it into custom UI patterns like icon-based toolbars.

API Reference

ColorPicker

A compact color selection control with a floating advanced picker.

PropTypeDefault
defaultValuestring"#000000"
size"sm" | "md" | "lg""md"
classstring-
idstring-
namestring-
disabledbooleanfalse
requiredbooleanfalse
readonlybooleanfalse
<ColorPicker defaultValue="#2563eb" size="md" />

Additional Notes:

  • Supports additional standard input attributes such as autocomplete, form, min, max, step, and title
  • Supports aria-* attributes for accessibility metadata
  • The root element exposes a setValue("rgb(r,g,b)") method for programmatic updates
  • Emits starwind-color-picker:change with detail { value: string, selectId: string }

Changelog

v1.0.0

  • Initial Release with Starwind v2.0.0