Skip to content

UI kit: Select #2265

Open
Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Create the shared dropdown select to replace MUI Select/MenuItem/InputLabel/FormControl (used in 4 files) and the raw <select> elements.

Dependencies

Action Items

  • Add @radix-ui/react-select.
  • Create client/src/components/ui/select.tsx exporting Select, SelectTrigger, SelectContent, SelectItem, SelectValue (shadcn-style compound parts) and a simple convenience form: <Select label="Project" value onValueChange options={[{value, label}]} />. Style the trigger to match the current outlined MUI select (same height, border, arrow).
  • Support an error state and a placeholder, and keep a hidden native input when used in a <form> (Radix does this when name is passed) so form posts and react-hook-form Controller work.
  • Tests: opens with click and with Enter/Space/ArrowDown, arrow keys move, Enter selects, Escape closes, onValueChange fires, disabled does not open. (Radix needs the jsdom stubs from the foundation ticket.)
  • Catalogue entry (closed, open, selected, placeholder, error, disabled).

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: custom vs native select. Proposed default: Radix Select (consistent look and keyboard behavior across browsers). A native <select> styled with Tailwind is simpler and good on phones; if the team prefers that, this ticket shrinks and the compound API is dropped.
  • Radix Select renders its list in a portal. With the important flag on this is fine, but check that the popup appears above the app shell box (overflow: hidden in App.jsx).

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