ColorInput
A text input with an integrated color picker preview that allows for advanced hex color selection.
When To Use
- Used when the user needs to customize the color selection.
Basic Usage
The simplest usage.
astro
---
import ColorInput from '@/components/data-entry/ColorInput.astro';
---
<ColorInput value="#3b82f6" /> Label and Error States
ColorInput supports custom labels and visual validation states.
Invalid color selection
astro
---
import ColorInput from '@/components/data-entry/ColorInput.astro';
---
<ColorInput label="Brand Color" value="#10b981" />
<ColorInput label="Theme Color" value="#ef4444" error="Invalid color selection" /> Disabled
Set to disabled state.
astro
---
import ColorInput from '@/components/data-entry/ColorInput.astro';
---
<ColorInput value="#a8a29e" disabled /> Properties
| Property | Description | Type | Default |
|---|---|---|---|
| value | The current hex color value. | string | '#000000' |
| label | The label to display above the input. | string | '' |
| class | Additional CSS classes for styling. | string | '' |
| error | Indicates an error state or displays an error message | string | boolean | |
| success | Indicates a success state or displays a success message | string | boolean | |
| disabled | Disables the component | boolean | false |