TidalUI

Color picker preview

A controlled native color and hex field pair with presets, validation, read-only and disabled states, and native form reset support.

pro · Forms · primitive

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add @tidal-pro/color-picker

Import components/ui/tidal.css, components/ui/color-picker.css. Wrap installed components in tidal-scope.

Preview

Color picker component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/color-picker.css";
import{TidalColorPicker}from"./components/ui/color-picker";
export default()=><div className="tidal-scope"><TidalColorPicker onValueChange={() => {}} presets={[{id:"example",value:"value",label:"Demo",accessibleLabel:"Demo"}]} title={"Demo"} value={"value"}/></div>;

API and props

TidalColorPicker.onValueChange (required)
(value: string, source: TidalColorPickerChangeSource, event: TidalColorPickerChangeEvent) => void

Callback invoked when the value change interaction is proposed.

TidalColorPicker.presets (required)
ReadonlyArray<TidalColorPreset>

Required presets value accepted by this exported component.

TidalColorPicker.title (required)
ReactNode

Required title value accepted by this exported component.

TidalColorPicker.value (required)
string

Required value value accepted by this exported component.

TidalColorPicker.colorInputProps
Omit<InputHTMLAttributes<HTMLInputElement>, "disabled" | "type" | "value" | "defaultValue" | "aria-disabled" | "aria-readonly" | "children" | "readOnly"> | undefined

Optional color input props value accepted by this exported component.

TidalColorPicker.colorInputRef
Ref<HTMLInputElement> | undefined

Optional color input ref value accepted by this exported component.

TidalColorPicker.description
ReactNode

Optional description value accepted by this exported component.

TidalColorPicker.disabled
boolean | undefined

Optional disabled value accepted by this exported component.

TidalColorPicker.eyebrow
ReactNode

Optional eyebrow value accepted by this exported component.

TidalColorPicker.footer
ReactNode

Optional footer value accepted by this exported component.

TidalColorPicker.headingLevel
"h2" | "h3" | "h4" | undefined

Optional heading level value accepted by this exported component.

TidalColorPicker.hexInputProps
Omit<InputHTMLAttributes<HTMLInputElement>, "disabled" | "type" | "value" | "defaultValue" | "spellCheck" | "aria-disabled" | "aria-readonly" | "children" | "maxLength" | "pattern" | "placeholder" | "readOnly" | "required"> | undefined

Optional hex input props value accepted by this exported component.

TidalColorPicker.hexInputRef
Ref<HTMLInputElement> | undefined

Optional hex input ref value accepted by this exported component.

TidalColorPicker.hint
ReactNode

Optional hint value accepted by this exported component.

TidalColorPicker.labels
Partial<TidalColorPickerLabels> | undefined

Optional labels value accepted by this exported component.

TidalColorPicker.readOnly
boolean | undefined

Optional read only value accepted by this exported component.

TidalColorPicker.required
boolean | undefined

Optional required value accepted by this exported component.

TidalColorPicker.resetAction
TidalColorPickerResetAction | undefined

Optional reset action value accepted by this exported component.

TidalColorPicker.validationMessage
ReactNode

Optional validation message value accepted by this exported component.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas