Theme

Start Here

Start from the smallest working snippet, then move to interactive examples and the full API contract below.

Styled quick start

Copy this entrypoint first. It includes the imports required to get the component on screen.

svelte
<script lang="ts">
  import '@dryui/ui/themes/default.css';
  import '@dryui/ui/themes/dark.css';
  import { ColorPicker } from '@dryui/ui';
</script>

<ColorPicker.Root>
  <ColorPicker.Area>...</ColorPicker.Area>
  <ColorPicker.HueSlider>...</ColorPicker.HueSlider>
  <ColorPicker.AlphaSlider>...</ColorPicker.AlphaSlider>
  <ColorPicker.Input>...</ColorPicker.Input>
  <ColorPicker.Swatch>...</ColorPicker.Swatch>
  <ColorPicker.EyeDropper>...</ColorPicker.EyeDropper>
</ColorPicker.Root>

Import options

Root package

ts
import { ColorPicker } from '@dryui/ui'

Per-component subpath

ts
import { ColorPicker } from '@dryui/ui/color-picker'

Customize

Use the interactive examples to see common variants, states, and composition patterns before building your own.

Basic Color Picker

svelte
<script lang="ts">
  let color = $state('#3b82f6');
</script>
<ColorPicker.Root bind:value={color}>
  <ColorPicker.Area />
  <ColorPicker.HueSlider />
  <ColorPicker.Input format="hex" />
</ColorPicker.Root>

With Alpha Slider

With Swatches

svelte
<ColorPicker.Root value="#ef4444">
  <ColorPicker.Area />
  <ColorPicker.HueSlider />
  <div class="color-picker-swatches">
    <Flex gap="sm">
      <ColorPicker.Swatch color="#ef4444" />
      <ColorPicker.Swatch color="#3b82f6" />
      <ColorPicker.Swatch color="#22c55e" />
      <ColorPicker.Swatch color="#f59e0b" />
      <ColorPicker.Swatch color="#8b5cf6" />
    </Flex>
  </div>
</ColorPicker.Root>

Structure

Compound components always start with ColorPicker.Root. Use this structure block to understand required wrappers before you wire state or styling.

ColorPicker.Root
  ColorPicker.Area
  ColorPicker.HueSlider
  ColorPicker.AlphaSlider
  ColorPicker.Input
  ColorPicker.Swatch
  ColorPicker.EyeDropper
ColorPicker.Root ColorPicker.AreaColorPicker.HueSliderColorPicker.AlphaSliderColorPicker.InputColorPicker.SwatchColorPicker.EyeDropper

Compose

The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.

Compound component. Start with ColorPicker.Root, then add only the parts you need.

ColorPicker.AreaColorPicker.HueSliderColorPicker.AlphaSliderColorPicker.InputColorPicker.SwatchColorPicker.EyeDropper

ColorPicker.Root

Prop Type Default Required Bindable
value
string
'#ff0000'
alpha
number
1
disabled
boolean
children
Snippet

Forwards <div> attributes via rest props. Common examples: id, style, role.

ColorPicker.Area

Prop Type Default Required Bindable
width
number
200
height
number
150

Forwards <div> attributes via rest props. Common examples: id, style, role.

ColorPicker.HueSlider

Prop Type Default Required Bindable

Forwards <input> attributes via rest props. Common examples: name, autocomplete, inputmode. Omitted: value, type, min, max, step.

ColorPicker.AlphaSlider

Prop Type Default Required Bindable

Forwards <input> attributes via rest props. Common examples: name, autocomplete, inputmode. Omitted: value, type, min, max, step.

ColorPicker.Input

Prop Type Default Required Bindable
format
hexrgbhsl
'hex'

Forwards <input> attributes via rest props. Common examples: name, autocomplete, inputmode. Omitted: value, type.

ColorPicker.Swatch

Prop Type Default Required Bindable
color
string

Forwards <div> attributes via rest props. Common examples: id, style, role.

ColorPicker.EyeDropper

Prop Type Default Required Bindable

Forwards <button> attributes via rest props. Common examples: type, disabled, name.