Color Picker

Select a color and opacity and return a HEX, RGB, or HSB value.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-colorpicker
  format="hex"
  opacity="1"
  trigger="click"
  showtext
  value="#6750a4"
  id="sample"
></sy-colorpicker>

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 value as HEX, RGB, or HSB matching format.
Opacity
opacity ranges from 0 to 1. Use hideOpacity when opacity adjustment is unnecessary.

Feature examples

#

Choose a feature from 10 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Disabled

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Format

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Hide Opacity

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Inline

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Opacity

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Readonly

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · ShowText

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Value

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Events · Changed

Interact with the component to see event names and payloads in the live preview below.

View code
HTML
Loading the example.

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 / PropertyTypeDefaultDescription
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.
number1Opacity: 0 is transparent and 1 is opaque.
booleanfalseShow the selected color value on the trigger.
ColorTrigger'click'Open the popup on click or pointer entry.
booleanfalseBlock user interaction and keyboard focus.
booleanfalseDisplay the current value while preventing edits.
booleanfalseAlways show the editor panel instead of a popup.
booleanfalseHide the opacity control.
ColorFormat'hex'One of hex, rgb, or hsb. Set value to a string in the same format.

Events

EventDetailDescription
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

MethodReturnsDescription
Promise<void>Open the color picker popup.
Promise<void>Close the open panel.
Promise<void>Change the color value and, optionally, its format.

Slots

SlotDescription
Content displayed in the trigger area.

<sy-colorpicker-content>

Properties

Attribute / PropertyTypeDefaultDescription
string'#ff0000'Current value or item identifier.
number1Opacity: 0 is transparent and 1 is opaque.
booleanfalseHide the opacity control.
'hex' | 'rgb' | 'hsb''hex'Format used to display and parse values. See the usage guide for tokens or format values.
booleanfalseBlock user interaction and keyboard focus.
booleanfalseDisplay the current value while preventing edits.

Events

EventDetailDescription
CustomEvent<{ value: string; opacity: number; format: string }>Read the result from the event's detail.