Color Picker
Select a color and opacity and return a HEX, RGB, or HSB value.
Usage guide
#Use when users need to choose an arbitrary color. A fixed palette is simpler when only predefined brand colors are allowed.
Open when needed
The default popup is suitable for a compact color setting.
Adjust continuously
Keep the panel visible with inline for repeated color adjustments.
- Color format
- Pass
valueas HEX, RGB, or HSB matchingformat. - Opacity
opacityranges from 0 to 1. UsehideOpacitywhen opacity adjustment is unnecessary.
Examples
#Feature examples
#Choose a feature from 10 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.
No matching features.
API reference
#Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.
<sy-colorpicker>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
string | '#5A2A82' | Selected color. HEX is the default format. For RGB or HSB strings, also set format. | |
string | '' | Initial color, applied when value is not specified. | |
number | 1 | Opacity: 0 is transparent and 1 is opaque. | |
boolean | false | Show the selected color value on the trigger. | |
ColorTrigger | 'click' | Open the popup on click or pointer entry. | |
boolean | false | Block user interaction and keyboard focus. | |
boolean | false | Display the current value while preventing edits. | |
boolean | false | Always show the editor panel instead of a popup. | |
boolean | false | Hide the opacity control. | |
ColorFormat | 'hex' | One of hex, rgb, or hsb. Set value to a string in the same format. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<ColorChangeDetail> | Emitted when the value or selection state changes. | |
CustomEvent<void> | Emitted when the list opens. | |
CustomEvent<void> | Read the result from the event's detail. | |
CustomEvent<ColorFormatChangeDetail> | Read the result from the event's detail. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<void> | Open the color picker popup. | |
Promise<void> | Close the open panel. | |
Promise<void> | Change the color value and, optionally, its format. |
Slots
| Slot | Description |
|---|---|
| Content displayed in the trigger area. |
<sy-colorpicker-content>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
string | '#ff0000' | Current value or item identifier. | |
number | 1 | Opacity: 0 is transparent and 1 is opaque. | |
boolean | false | Hide the opacity control. | |
'hex' | 'rgb' | 'hsb' | 'hex' | Format used to display and parse values. See the usage guide for tokens or format values. | |
boolean | false | Block user interaction and keyboard focus. | |
boolean | false | Display the current value while preventing edits. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<{ value: string; opacity: number; format: string }> | Read the result from the event's detail. |