ColorInput
Un campo de texto con una vista previa integrada de selección de color que permite la selección avanzada de colores hexadecimales.
Cuándo usar
- Se utiliza cuando el usuario necesita personalizar la selección de color.
Uso básico
El uso más simple.
astro
---
import ColorInput from '@/components/data-entry/ColorInput.astro';
---
<ColorInput value="#3b82f6" /> Estados de Etiqueta y Error
ColorInput soporta etiquetas personalizadas y estados de validación visual.
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" /> Deshabilitado
Establecido en estado deshabilitado.
astro
---
import ColorInput from '@/components/data-entry/ColorInput.astro';
---
<ColorInput value="#a8a29e" disabled /> Propiedades
| Propiedad | Descripción | Tipo | Por defecto |
|---|---|---|---|
| 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 |