Color Field

Loading...

Installation

Add the component with the CLI.

npx shadcn@latest add @intentui/color-field

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Manual installation

Install the dependencies, then copy the component source into your project.

npm install react-aria-components

Anatomy

import { ColorField } from "@/components/ui/color-field"
import { Label, Description } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
<ColorField>
  <Label/>
  <Input/>
  <Description/>
</ColorField>

Examples

Prefix

A color field can include a prefix to provide context or functionality.

Loading...

Suffix

A color field can also have a suffix.

Loading...

Controlled

Share the color field’s state with ColorSwatch to display the current color.

Loading...

Disabled

You can disable the color field, making it non-interactive.

Loading...

Validation

Set isRequired to require a value when the form is submitted.

Loading...

Component API

ColorField

ColorField extends the React Aria Components <ColorField> component.

classNamestring

See the React Aria for the full API reference.

Design