Skip to content

UI kit: RadioGroup and Switch #2264

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Create the shared radio group and on/off switch (built on Radix so keyboard and screen reader behavior is correct) to replace MUI Radio/RadioGroup/FormControlLabel and Switch.

Dependencies

Action Items

  • Add @radix-ui/react-radio-group and @radix-ui/react-switch.
  • Create client/src/components/ui/radio-group.tsx exporting RadioGroup and RadioGroupItem (item = radio plus its label, with a label prop). Match today's look from newUserForm.jsx and ProjectForm.jsx (MUI Radio colors use the primary color).
  • Create client/src/components/ui/switch.tsx exporting Switch (with optional visible label). Match the look defined by the MUI style overrides in components/user-admin/EditUsers.jsx lines ~29-50 (switch base, thumb, and track colors when checked) and the plain Switch in pages/OnboardOffboardVisibility.jsx.
  • Colocated tests: radio selection by click and by arrow keys, only one selected, onValueChange; switch toggles by click and Space, aria-checked, disabled does nothing.
  • Catalogue entries for both.

Acceptance Criteria

  • The component lives in client/src/components/ui/ as a .tsx file, with typed props that pass yarn typecheck (strict mode).
  • Styling uses Tailwind classes only. Variants (if any) are declared with cva, and className is merged with cn() so callers can override.
  • The component does not import anything from @mui/* or @emotion/*.
  • A test file next to the component (for example button.test.tsx) covers: it renders, each variant/size, the disabled and error states where they apply, and keyboard use where it applies (Tab, Enter/Space, Escape, arrow keys). yarn test passes.
  • The component has an entry on the /design-system page: description, props/variants, states, a short do/don't, a code example, and a live demo.
  • Visible focus: there is a clear focus ring when the control is reached by keyboard.
  • The PR does not change any existing screen. Screens adopt the component in their own tickets.

Resources/Instructions

Additional Notes

  • Decision needed: Radix package form. Proposed default: individual @radix-ui/react-* packages (smaller, explicit). The single radix-ui package is an acceptable alternative; just stay consistent in later tickets.
  • No checkbox is needed: the app has none today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: Design systemmilestone: missingrole: Front Endsize: 3pt

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions