Components
Selected
Selected always means primary: small things fill with it, cards take it as a border and lists mark it with a tick.
Selected always means primary. How it is drawn depends on what is being selected.
- Fill, for small things: a checkbox, a radio, a switch, a chip, a calendar cell. The background and border go
primaryand the mark or label goesprimary-foreground. - Border, for things with a description: choice cards. The card keeps its
cardsurface so the description stays readable. Its border goesprimaryand the control inside it fills. - Tick, for lists: the chosen item in a menu gets a tick at its end. The
accentfill is only for the item under the pointer or the keyboard, never for the chosen one. - Raised, the one exception: the segmented control and pill tabs switch a view rather than answer a question, so the active item lifts off a muted track. Underline and secondary tabs mark the active tab with a line or a muted block instead.
A selected item does not change on hover. On focus, a filled control draws a 1px primary-foreground line just inside its edge, and a selected card doubles its border. State rules has the rest.
import { Checkbox } from '@dex/shared/components/checkbox'
import { RadioGroup, RadioGroupItem } from '@dex/shared/components/radio-group'
import { Switch } from '@dex/shared/components/switch'
export function SelectedFill() {
return (
<>
<Checkbox aria-label="Open to relocating" />
<Checkbox aria-label="Open to contract roles" defaultChecked />
<RadioGroup aria-label="Notice period" defaultValue="1-month" className="flex gap-4">
<RadioGroupItem value="immediately" aria-label="Immediately" />
<RadioGroupItem value="1-month" aria-label="1 month" />
</RadioGroup>
<Switch aria-label="Weekly digest" />
<Switch aria-label="Open to new roles" defaultChecked />
</>
)
}
import { Chip, ChipGroup } from '@dex/shared/components/chip-group'
export function SelectedChips() {
return (
<div className="flex w-full flex-col gap-4">
<ChipGroup type="single" defaultValue="51–200" aria-label="Company size">
<Chip value="11–50">11–50</Chip>
<Chip value="51–200">51–200</Chip>
<Chip value="201–1,000">201–1,000</Chip>
</ChipGroup>
<ChipGroup type="multiple" defaultValue={['Backend', 'Data']} aria-label="Areas">
<Chip value="Backend">Backend</Chip>
<Chip value="Platform">Platform</Chip>
<Chip value="Data">Data</Chip>
</ChipGroup>
</div>
)
}
'use client'
import { useState } from 'react'
import { MonthCalendar } from '@dex/shared/components/month-calendar'
export function SelectedCalendar() {
const [startMonth, setStartMonth] = useState(new Date(2026, 2, 1))
return <MonthCalendar selected={startMonth} onSelect={setStartMonth} className="w-64" />
}
import { ChoiceCardRadio, ChoiceCardRadioGroup } from '@dex/shared/components/choice-card'
export function SelectedBorder() {
return (
<ChoiceCardRadioGroup defaultValue="open" aria-label="Search mode" className="w-full max-w-xl">
<ChoiceCardRadio
value="active"
title="Actively looking"
description="Dex sends roles as soon as they match."
/>
<ChoiceCardRadio
value="open"
title="Open to the right role"
description="Only strong matches, a few times a month."
/>
</ChoiceCardRadioGroup>
)
}
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@dex/shared/components/select'
export function SelectedTick() {
return (
<Select
items={{ '2-weeks': '2 weeks', '1-month': '1 month', '3-months': '3 months' }}
defaultValue="1-month"
>
<SelectTrigger aria-label="Notice period" className="max-w-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="2-weeks">2 weeks</SelectItem>
<SelectItem value="1-month">1 month</SelectItem>
<SelectItem value="3-months">3 months</SelectItem>
</SelectContent>
</Select>
)
}
'use client'
import { useState } from 'react'
import { SegmentedControl, SegmentedControlItem } from '@dex/shared/components/segmented-control'
export function SelectedRaised() {
const [list, setList] = useState('saved')
return (
<SegmentedControl value={list} onValueChange={setList} aria-label="Roles">
<SegmentedControlItem value="all">All roles</SegmentedControlItem>
<SegmentedControlItem value="saved">Saved</SegmentedControlItem>
<SegmentedControlItem value="applied">Applied</SegmentedControlItem>
</SegmentedControl>
)
}