A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Color field#

Component <neo-color-field> is a 2D saturation/value picker painted over a base hue, with pointer and arrow-key handle movement. The host reflects value (hex); set hue to fix the base hue, or omit it and the kit derives one from value, so the simplest usage is a single value="#rrggbb".

Default
Derived hue
Explicit hue
Disabled
Custom size
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
valuestring reflected observed#2563ebSelected color as #rrggbb.
huenumber observednoneBase hue in degrees. If omitted, the hue is derived from value.
disabledboolean observedfalseDisables pointer and keyboard interaction.
aria-labelstringColor fieldAccessible label for the 2D field control.

Events #

NameDetailBubblesDescription
neo-color-field-input{ value: string, hue: number, x: number, y: number }yesFires continuously while the handle moves.
neo-color-field-change{ value: string, hue: number, x: number, y: number }yesFires when a drag or keyboard move commits.

CSS variables #

NameDefaultDescription
--neo-color-field-width14remField width.
--neo-color-field-height9remField height.
--neo-color-field-radiusvar(--page-radius, 0.5rem)Corner radius.
--neo-color-field-handle-size1remHandle diameter.
--neo-color-field-border-width1pxBorder width.
--neo-color-field-border-colorcolor-mix(in srgb, var(--page-fg) 16%, transparent)Border color.
--neo-color-field-focus-ringvar(--accent, currentColor)Focus-visible outline color.

Examples#

Derived hue#

The simplest form. Pass a value hex and the host derives the base hue from it on connect, so a freshly mounted picker shows the handle on the matching point of the saturation/value plane.

Explicit hue#

Set hue in degrees to override the derived value. Useful when the selected colour is desaturated (so the derived hue would be ambiguous) or when you want the field's gradient to stay anchored to a brand hue while the handle picks a tint.

Disabled#

Pointer events are blocked, the handle is non-interactive, and the host fades to a muted state. The currently-selected colour still reads correctly.

Custom size#

The field reads its dimensions from the --neo-color-field-width and --neo-color-field-height custom properties, so any inline style or scoped CSS rule resizes the picker without changing markup.

Examples: Datastar#

Morphing during interaction#

A Datastar fat-morph can change value, hue, or disabled mid-interaction.

  • The host stays mounted and reconciles its handle position and disabled state in place: no re-mount, no lost focus. Autoplay cycles the states below to simulate the morphs.
  • The cf_morph_value signal mirrors the live color (seeded by each morph, updated on neo-color-field-input) and drives the hex readout below the field.
Initial
Different color
Disabled
Deactivate Rename Duplicate
Delete
New state Toggle autoplay

#2563eb

HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator