ValyroUI Русская версия

Color Picker

Color selection. Free, MIT · Forms and input › Color, size and emoji

Installation

npx valyro-cli@latest add color-picker
npx shadcn@latest add https://valyro.xyz/r/color-picker.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { ColorPicker } from 'valyro-ui';

Props

PropTypeDefault
valuestringHex colour: #rrggbb, or #rrggbbaa when alpha is on and the colour is translucent.
defaultValuestringDEFAULT_COLORInitial value when uncontrolled.
onValueChange(value: string) => voidCalled with the new value when it changes.
alphabooleanfalseShow the opacity slider.
presetsstring[]Preset swatches (any hex form).
namestringSubmits the colour with the surrounding form as lowercase hex (#rrggbb or #rrggbbaa).
invalidbooleanfalseError state, e.g. from a FormField (marks the root with data-invalid).
labelsPartial<ColorPickerLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Date Of Birth Input · Next: Swatch Picker · All Forms and input