Sitewright

Segmented control

A single-select switch on a tinted track with a thumb that slides to the chosen segment; a native radio group with arrow keys, Home and End, plus a plain variant that only bolds the choice.

What it is for

Weekly / Monthly / Yearly switches, view toggles, table density.

Use it

1 · site.json
"effects": { "components": ["segmented-control"] }
or on the command line
node ~/.claude/skills/sitewright/scripts/scaffold.mjs --config site.json --out ./my-site --components segmented-control
2 · import it
import { SegmentedControl } from '@/components/fx/ui';

Files

  • components/fx/ui/SegmentedControl.tsx
  • components/fx/ui/_bui.tsx
  • components/fx/ui/LICENSE-boardui.txt
  • ui-bui-base.css styles
  • ui-segmented-control.css styles

Source

Adapted from BoardUI (MIT). Restyled in plain CSS and rewritten without its libraries; the upstream licence and notice are kept (see THIRD_PARTY_NOTICES.md).

Credits and licences: third-party notices.

Accessibility

  • Keyboard. Components in the kit are written to be reached and used with the keyboard. Try it: press Tab inside the preview.
  • Reduced motion. With prefers-reduced-motion on, animation settles to its finished state at once.
  • Touch. Pointer-follow effects are skipped on touch screens; controls stay finger-sized.