ColorPicker
Cualquier color, como código hexadecimal, con el selector del navegador al lado. El código se revisa mientras se escribe.
import { ColorPicker } from '@sypnia/ui/react'
En esta página
Un color de marca
Saved as #4174bf
Código
import { useState } from 'react';
import { ColorPicker, Field } from '@sypnia/ui/react';
// Any colour as a hex code, with the browser's picker. Write «#12» to see the message.
export default function Brand() {
const [c, setC] = useState('#4174bf');
return <Field label="Brand colour" hint={`Saved as ${c}`}><ColorPicker value={c} onChange={setC} /></Field>;
} Cuándo usarlo
Úsalo cuando
- Colores de marca y temas.
No lo uses cuando
- Un conjunto fijo de colores: usa ColorSwatchPicker.
Para todos
- El código es el control principal; un código mal escrito dice cómo escribirlo.
Props
| ColorPicker | Tipo | Por defecto |
|---|---|---|
onChangeobligatorio | (hex: string) => void | |
valueobligatorio | string | |
aria-describedby | string | |
aria-labelThe name for screen readers when there is no Field around it. | string | |
aria-labelledby | string | |
className | string | |
disabled | boolean | |
idInside a Field it comes from the Field. | string |