Skip to content

ColorPicker

Any colour, as a hex code, with the browser's picker beside it. The code is checked as it is typed.

import { ColorPicker } from '@sypnia/ui/react'

On this page
  1. A brand colour
  2. When to use it
  3. For everyone
  4. Props

A brand colour

Saved as #4174bf

Code
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>;
}

When to use it

Use it when

  • Brand colours and themes.

Do not use it when

  • A fixed set of colours: use ColorSwatchPicker.

For everyone

  • The hex code is the main control; a wrong code says how to write it.

Props

ColorPickerTypeDefault
onChangerequired (hex: string) => void
valuerequired string
aria-describedby string
aria-label

The name for screen readers when there is no Field around it.

string
aria-labelledby string
className string
disabled boolean
id

Inside a Field it comes from the Field.

string
  1. A brand colour
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms