Color field
Accepts a hex color, or one color channel as a number.
color-field-demo.tsx
Installation
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
npm
yarn
pnpm
bun
Single channel
Set colorSpace and channel to edit one channel as a number.
color-field-channel-demo.tsx
Disabled
color-field-disabled-demo.tsx
Controlled value
Also install Color swatch.
color-field-controlled-demo.tsx
Sizes
color-field-sizes-demo.tsx
API reference
vip/ui adds or changes the props below. For all other props, see React Aria ColorField (opens in a new tab).
- size: "xs" | "sm" | "md" | "lg" | "xl" = "lg"
- Sets the size of the field.
- label: string
- Label above the field. Without a label, pass aria-label.
- description: string
- Help text below the field.