Skip to main content

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​

PropTypeDefaultMeaning
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.
allowNoneboolean–Offers "no colour" as a last choice.
classNamestring–

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.