Segmented toggle
Two to four named options in one outlined track, with exactly one always on. The chosen segment fills solid, so a setting never looks like a move on the board.
Usage
Use a segmented toggle (.seg) for a setting with two to four peers. Every one in the app sits in the Create game and Play solo sheets or the lobby:
| Setting | Options |
|---|---|
| Mode | Classic, Trivia |
| Board | 4×4, 5×5 |
| Round | 30s, 60s, 90s, 120s (Classic); 1 min, 2 min, 3 min (Trivia) |
| Min letters | 3, 4, 5, 6 |
| Difficulty | Mixed, Easy, Intermediate, Difficult |
| Kids mode | Off, On |
| Room | Private, Public |
| Teams (lobby, host only, in team mode) | Random, Pick |
Don't use the tile's lit look for the chosen segment. The pressed-tile treatment (--select) means "in the trace"; on a control it would make a setting look like a move.
Don't use it as tabs that hide content. The help sheet had a .seg tab row until 3.9.0; the tabs hid the Competing cards behind a control nobody had a reason to press.
Don't build a switch. There's no sliding on/off switch in the system. Private and Public used one until 3.19.7.
Anatomy
| Part | Spec | Token |
|---|---|---|
| Track | .seg: a flex row, 1px edge, radius 10; overflow: hidden clips the segments to its corners | --rule |
| Segment | button, flex: 1, min-height 44px, padding 10px 13px, 600 13px, line-height: 1, never wraps | transparent, --fg-soft |
| Chosen | .on | --fg fill, --ground text |
| Full width | .seg-full: padding 10px 4px, 12.5px, for four longer labels | |
| Room in the lobby | .room-seg: 200px wide, centred under the room code, two equal halves | |
| Row | .opt-row: setting name on the left (600 14px), toggle on the right, 12px apart. .opt-col stacks the name over a full-width toggle | --fg |
Segments are real <button>s with appearance: none, margin: 0 and line-height: 1, so their labels sit dead centre in iOS Safari.
States
| State | Look |
|---|---|
| Not chosen | transparent, --fg-soft label |
| Chosen | --fg fill, --ground label |
| Pressed | the shared dip: scale(0.98) and brightness(0.94) over 0.07s |
| Focus | 2px --fg ring, offset 2px |
There's no empty state and no disabled state. One option is always on. An option that doesn't apply is removed, not greyed: Team appears only when team mode is switched on, Kids mode is hidden in Trivia, and Play solo has no Room row because nobody else can join.
Behaviour
- A tap chooses. The setting changes at once; there's nothing to confirm.
- One always on. Opening Play solo resets a leftover Team mode, so the Mode toggle never shows with nothing lit.
- Mode changes what's under it. Classic shows Board, Round and Min letters; Trivia shows Round, Difficulty and a three-line rules card. The visible panel sets the height and the hidden one is lifted out of flow.
- Private and Public in the lobby are live for the host. A guest sees a read-only line instead ("Private room" or "Public room").
- The Teams toggle (Random, Pick) changes how the host sorts players; Pick lets them tap anyone to send them to the other side. Team mode ships switched off (3.11.1), so nobody sees this toggle today.
Accessibility
| Pair | Dark | Light |
|---|---|---|
--ground on --fgthe chosen segment | 12.70AAA | 12.70AAA |
| Pair | Dark | Light |
|---|---|---|
--fg-soft on --grounda segment not chosen | 6.36AA | 4.78AA |
- Target size: every segment is 44px tall.
- State is exposed in three different ways. The lobby's Private and Public are a
radiogroupwitharia-checked; Mode and Teams usearia-pressed; Board, Round, Min letters, Difficulty, Kids mode and the sheet's Room expose nothing, so a screen reader can't tell which is on. See Known issues. - Reduced motion: no dip on press, only a dim.
Content
- Short labels that fit one line: "Classic", "2 min", "4×4", "30s". The row's name says what the setting is; the segments say only the options.
- Units follow the mode. Classic rounds are in seconds ("60s"), trivia rounds in minutes ("2 min").
- The same words everywhere. Trivia's levels read Easy, Intermediate and Difficult in the toggle, the question card and the lobby.
- Sentence case.
Why it's built this way
Known issues and gaps
- Most toggles don't say which option is on. Only the lobby's Private and Public (
aria-checked) and Mode and Teams (aria-pressed) expose their state. One pattern applied to every toggle would close the gap. - Kids mode is Off and On, the one place the toggle stands in for a switch.
- Switching Mode resizes the sheet. Since 3.23 the hidden panel is lifted out of flow, so the rows below Mode move when it changes. A comment in the JSX still says both panels share one cell so nothing below can move.
- The toggle's CSS reads legacy names (
--tray-line,--paper-dim,--gold,--gold-ink); they resolve to--rule,--fg-soft,--fgand--ground.
Related
- Tile: the lit look the toggle never uses
- Button: the shared press state
- Sheet: where the toggles live
Changelog
| Version | Change |
|---|---|
| 3.23.0 | Trivia mode's Difficulty toggle (Mixed, Easy, Intermediate, Difficult), full width |
| 3.19.7 | Private and Public become the system's toggle, replacing a sliding-knob switch; labels centred on iOS Safari |
| 3.11.1 | Team leaves the Mode toggle until team mode is switched on |
| 3.10.0 | Mode is three-up with Team; Random and Pick for the host; Practice (now Play solo) never shows Mode with nothing lit |
| 3.9.0 | The help sheet's tab row is removed |