TonePicker
import { TonePicker } from "@study/ui"
Result
Loading...
Live Editor
function Example() { const [tone, setTone] = useState("blau"); return ( <div className="ui-stack"> <TonePicker label="Course colour" value={tone} onChange={setTone} allowNone /> <Card tone={tone ?? "grau"} padding="sm">Control Engineering</Card> </div> ); }
Light
Dark
When to use
- For the colour of a course – in the course card's menu and when creating it.
- Only the eight course colours; there are no custom colours, so that everything fits together.
Props
| Prop | Type | Default | Meaning |
|---|---|---|---|
label * | string | – | What the colour is for, e.g. "Course colour". |
onChange * | (tone: "blau" | "petrol" | "gruen" | "gelb" | "orange" | "rot" | "violett" | "grau" | null) => void | – | |
value * | "blau" | "petrol" | "gruen" | "gelb" | "orange" | "rot" | "violett" | "grau" | null | – | The chosen tone; null for none. |
allowNone | boolean | – | Offers "no colour" as a last choice. |
className | string | – |
Accessibility
- Real radio buttons in a
radiogroup: arrow keys switch, every colour has its name. - The chosen colour has a ring, not just a different colour.