Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(ui): refresh checkbox, switch, and radio controls (#9074)
dev-rb6de39f923cc7
diff --git a/.agents/rules/web/ui-primitives.md b/.agents/rules/web/ui-primitives.mdindex e9724c70ff..cd77649981 100644--- a/.agents/rules/web/ui-primitives.md+++ b/.agents/rules/web/ui-primitives.md@@ -68,3 +68,25 @@ Applies to `apps/web/src/components/ui`, including ports from shadcn-solid.and the corresponding state-mix direction. Reset runtime material assignmentsat theme boundaries so previews resolve their own palette. Do not persistderived Button tokens in authored theme data.++## Selection controls++- Use `Checkbox` for independent values, `RadioGroup` for one choice among values,+ and `ToggleSwitch` for a setting that takes effect immediately. Retain their+ native inputs, accessible labels, controlled/uncontrolled state, and keyboard behavior.+- Keep unchecked checkbox and radio faces transparent. Checked and indeterminate+ controls use the accent fill. Checkbox marks and radio indicators share the+ primary Button's `button-primary-ink` token.+- Set checkbox/radio size on the root: `sm` is 14px, `md` (default) is 16px,+ and `lg` is 20px. `ToggleSwitch` tracks use `xs` 28×14px, `sm` (default)+ 32×16px, and `md` 40×20px. Do not resize internal SVGs or override selection+ colors from callers or enclosing pages; checked controls use the theme accent.+- Render `Checkbox.Control` or `RadioGroup.ItemControl` once per value; each+ includes its native input and default indicator. Do not add a second Input slot.+- Use `InlineCheckbox` only as an aria-hidden decoration for an interactive row+ or selection control that owns selection, focus, and input semantics. Entity+ list selection uses it inside `MultiSelectCheckbox` to retain shift-click and+ full-cell hit targets. Single-select menus retain their trailing+ `SingleSelectCheck`, not a checkbox.+- Keep checkbox draw/retract and switch press motion CSS-only and respect reduced+ motion. Preserve selection-control focus indicators independently of Button styling.diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 119f669f77..52a4cfeee3 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -215,6 +215,10 @@ the user's newest account for that app from the last fifteen minutes.### General+- Keep selection controls on shared `Checkbox`, `ToggleSwitch`, and `RadioGroup`;+ preserve their native input semantics and use root sizing instead of internal+ control/glyph overrides. See the [selection-control contract](../../.agents/rules/web/ui-primitives.md#selection-controls).+Agent split headers show live viewers through `BlockLiveIndicators` with theresolved session ID; keep the existing `AgentSessionProvider` subscription to`agent_session` rather than enabling legacy block tracking of placeholder IDs.diff --git a/apps/web/src/components/ui/components/Checkbox.docs.tsx b/apps/web/src/components/ui/components/Checkbox.docs.tsxindex a13cb89579..8e18abadac 100644--- a/apps/web/src/components/ui/components/Checkbox.docs.tsx+++ b/apps/web/src/components/ui/components/Checkbox.docs.tsx@@ -43,6 +43,30 @@ function StatesDemo() {Disabled</Checkbox.Label></Checkbox>+ <Checkbox validationState="invalid">+ <Checkbox.Control />+ <Checkbox.Label>Accept the terms</Checkbox.Label>+ <Checkbox.ErrorMessage class="text-xs text-failure">+ Required to continue.+ </Checkbox.ErrorMessage>+ </Checkbox>+ </div>+ );+}+// #endregion++// #region demo:sizes+function SizesDemo() {+ return (+ <div class="flex flex-wrap items-center gap-6">+ <For each={['sm', 'md', 'lg'] as const}>+ {(size) => (+ <Checkbox size={size} defaultChecked>+ <Checkbox.Control />+ <Checkbox.Label>{size}</Checkbox.Label>+ </Checkbox>+ )}+ </For></div>);}@@ -111,9 +135,16 @@ export default defineDoc({id: 'states',title: 'States',description:- '`indeterminate` shows a dash instead of a check — use it for a parent whose children are partially selected.',+ 'Indeterminate, disabled, and invalid states share the same transparent empty face and accent-filled selection. Checkmarks animate in both directions and respect reduced motion.',render: StatesDemo,},+ {+ id: 'sizes',+ title: 'Sizes',+ description:+ 'Use sm for compact list affordances, md (the default) for ordinary fields, or lg for a larger box. The size prop scales the mark with its control.',+ render: SizesDemo,+ },{id: 'list-affordances',title: 'List affordances',diff --git a/apps/web/src/components/ui/components/Checkbox.tsx b/apps/web/src/components/ui/components/Checkbox.tsxindex 295f750821..a735e6b88b 100644--- a/apps/web/src/components/ui/components/Checkbox.tsx+++ b/apps/web/src/components/ui/components/Checkbox.tsx@@ -1,52 +1,94 @@import CheckIcon from '@icon/system/regular/check.svg';-import MinusIcon from '@icon/system/regular/minus.svg';-import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox';-import type { ComponentProps } from 'solid-js';-import { splitProps } from 'solid-js';+import {+ Checkbox as KobalteCheckbox,+ useCheckboxContext,+} from '@kobalte/core/checkbox';+import {+ type ComponentProps,+ createContext,+ splitProps,+ useContext,+} from 'solid-js';import { cn } from '../utils/classname';+import { createVariants } from '../utils/variants';-/*-<Checkbox checked={...} onChange={...}>- <Checkbox.Control />-</Checkbox>--A bare <Checkbox.Control /> renders its own <Checkbox.Indicator /> with a-check (or minus for indeterminate). Override by passing children:--<Checkbox.Control>- <Checkbox.Indicator>- <CustomGlyph />- </Checkbox.Indicator>-</Checkbox.Control>-*/--export type CheckboxProps = ComponentProps<typeof KobalteCheckbox>;+export type CheckboxSize = 'sm' | 'md' | 'lg';+export type CheckboxProps = ComponentProps<typeof KobalteCheckbox> & {+ size?: CheckboxSize;+};type ControlProps = ComponentProps<typeof KobalteCheckbox.Control>;type IndicatorProps = ComponentProps<typeof KobalteCheckbox.Indicator>;type LabelProps = ComponentProps<typeof KobalteCheckbox.Label>;-const CONTROL_CLASS = cn(- 'inline-flex items-center justify-center size-4 shrink-0 rounded-sm text-surface',- 'bg-surface border-1 border-edge',- 'data-checked:bg-accent data-checked:border-accent',- 'data-indeterminate:bg-accent data-indeterminate:border-accent',- 'data-disabled:opacity-50 data-disabled:cursor-not-allowed',- 'data-invalid:border-failure',- 'peer-focus-visible:ring-2 peer-focus-visible:ring-accent'+const CheckboxSizeContext = createContext((): CheckboxSize => 'md');+const checkboxVariants = createVariants(+ 'inline-grid shrink-0 place-items-center rounded border border-border-primary bg-transparent text-button-primary-ink data-checked:border-accent data-checked:bg-accent data-indeterminate:border-accent data-indeterminate:bg-accent',+ {+ size: {+ sm: 'size-3.5',+ md: 'size-4',+ lg: 'size-5',+ },+ },+ { size: 'md' });+const markSizes: Record<CheckboxSize, string> = {+ sm: 'size-2.5',+ md: 'size-3',+ lg: 'size-3.5',+};++/** Keep both paths mounted so checking and unchecking use the same motion. */+function CheckboxMark(props: {+ checked: boolean;+ indeterminate: boolean;+ size: CheckboxSize;+}) {+ return (+ <svg+ aria-hidden="true"+ viewBox="0 0 12 12"+ fill="none"+ stroke="currentColor"+ stroke-width="2.25"+ stroke-linecap="round"+ stroke-linejoin="round"+ class={cn('block', markSizes[props.size])}+ >+ <path+ d="M2 6.25 4.5 8.75 10 3.25"+ pathLength="1"+ stroke-dasharray="1 2"+ stroke-dashoffset={props.checked && !props.indeterminate ? 0 : 1.2}+ class="transition-[stroke-dashoffset] duration-100 ease-out motion-reduce:transition-none"+ />+ <path+ d="M2.5 6h7"+ pathLength="1"+ stroke-dasharray="1 2"+ stroke-dashoffset={props.indeterminate ? 0 : 1.2}+ class="transition-[stroke-dashoffset] duration-100 ease-out motion-reduce:transition-none"+ />+ </svg>+ );+}function CheckboxIndicator(props: IndicatorProps) {- const [local, rest] = splitProps(props, ['class', 'children']);+ const [local, rest] = splitProps(props, ['class', 'children', 'forceMount']);+ const context = useCheckboxContext();+ const size = useContext(CheckboxSizeContext);return (<KobalteCheckbox.Indicator- class={cn('group inline-flex items-center justify-center', local.class)}+ forceMount={local.forceMount ?? local.children == null}+ class={cn('inline-flex items-center justify-center', local.class)}{...rest}>{local.children ?? (- <>- <CheckIcon class="size-3 group-data-indeterminate:hidden" />- <MinusIcon class="size-3 hidden group-data-indeterminate:block" />- </>+ <CheckboxMark+ checked={context.checked()}+ indeterminate={context.indeterminate()}+ size={size()}+ />)}</KobalteCheckbox.Indicator>);@@ -54,10 +96,18 @@ function CheckboxIndicator(props: IndicatorProps) {function CheckboxControl(props: ControlProps) {const [local, rest] = splitProps(props, ['class', 'children']);+ const size = useContext(CheckboxSizeContext);return (<><KobalteCheckbox.Input class="peer sr-only" />- <KobalteCheckbox.Control class={cn(CONTROL_CLASS, local.class)} {...rest}>+ <KobalteCheckbox.Control+ class={cn(+ checkboxVariants({ size: size() }),+ 'data-disabled:cursor-not-allowed data-invalid:border-failure peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-accent',+ local.class+ )}+ {...rest}+ >{local.children ?? <CheckboxIndicator />}</KobalteCheckbox.Control></>@@ -70,35 +120,34 @@ function CheckboxLabel(props: LabelProps) {}/**- * A Kobalte checkbox with the app's control styling, composed from slots so- * the label, description, and error message are yours to place.+ * A checkbox for a value that can be saved or selected independently.*- * @do Always render a `Checkbox.Label`, even when the visible text sits- * elsewhere.- * @do Use `indeterminate` on a select-all that only covers part of its group.- * @do Use `InlineCheckbox` when the whole row is already clickable.- * @dont Do not use a checkbox for an immediate action — that is a ToggleSwitch- * or a Button.- * @dont Do not add `Checkbox.Input` yourself; `Checkbox.Control` already- * renders one.+ * @do Use the size prop rather than resizing the control with classes.+ * @do Render a Checkbox.Label or provide an accessible name on the root.+ * @do Use indeterminate when only part of a select-all group is checked.+ * @do Use InlineCheckbox when an enclosing option owns the interaction.+ * @dont Add Checkbox.Input yourself; Checkbox.Control already renders one.+ * @dont Use a checkbox for an immediate setting change; use ToggleSwitch.*/export const Checkbox = Object.assign((props: CheckboxProps) => {- const [local, rest] = splitProps(props, ['class']);+ const [local, rest] = splitProps(props, ['class', 'size']);return (- <KobalteCheckbox- class={cn('relative inline-flex items-center gap-2', local.class)}- {...rest}- />+ <CheckboxSizeContext.Provider value={() => local.size ?? 'md'}>+ <KobalteCheckbox+ class={cn(+ 'relative inline-flex items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',+ local.class+ )}+ {...rest}+ />+ </CheckboxSizeContext.Provider>);},{- ErrorMessage:- KobalteCheckbox.ErrorMessage /* passthrough — styled via class at use sites */,- Description:- KobalteCheckbox.Description /* passthrough — styled via class at use sites */,- Input:- KobalteCheckbox.Input /* passthrough — Control already renders one */,+ ErrorMessage: KobalteCheckbox.ErrorMessage,+ Description: KobalteCheckbox.Description,+ Input: KobalteCheckbox.Input,Indicator: CheckboxIndicator,Control: CheckboxControl,Label: CheckboxLabel,@@ -111,21 +160,22 @@ export const SingleSelectCheck = (props: { active: boolean }) => (/>);-/**- * Inline checkbox affordance — a small square that fills accent when checked- * and shows an outlined empty box when not. Matches the soup-menu checkbox- * pattern. Visual-only; pair with a clickable parent for the actual toggle.- */-export const InlineCheckbox = (props: { checked: boolean }) => (+/** Visual-only; the enclosing row owns selection, focus, and input semantics. */+export const InlineCheckbox = (props: {+ checked: boolean;+ indeterminate?: boolean;+ size?: CheckboxSize;+}) => (<span- aria-hidden- class={cn(- 'inline-flex items-center justify-center size-3.5 shrink-0 rounded-sm',- props.checked- ? 'bg-accent text-surface'- : 'bg-transparent border-1 border-edge-muted text-transparent'- )}+ aria-hidden="true"+ data-checked={props.checked ? '' : undefined}+ data-indeterminate={props.indeterminate ? '' : undefined}+ class={checkboxVariants({ size: props.size ?? 'sm' })}>- <CheckIcon class="size-2.5" />+ <CheckboxMark+ checked={props.checked}+ indeterminate={props.indeterminate ?? false}+ size={props.size ?? 'sm'}+ /></span>);diff --git a/apps/web/src/components/ui/components/RadioGroup.docs.tsx b/apps/web/src/components/ui/components/RadioGroup.docs.tsxindex 151d5dd942..cb42bfb9e6 100644--- a/apps/web/src/components/ui/components/RadioGroup.docs.tsx+++ b/apps/web/src/components/ui/components/RadioGroup.docs.tsx@@ -37,15 +37,16 @@ function HorizontalDemo() {return (<RadioGroupdefaultValue="this_event"+ size="sm"aria-label="Apply changes to"class="flex-row items-center gap-3 text-xs text-ink-muted"><RadioGroup.Item value="this_event" class="gap-1.5">- <RadioGroup.ItemControl class="size-3.5" />+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel>This event</RadioGroup.ItemLabel></RadioGroup.Item><RadioGroup.Item value="all" class="gap-1.5">- <RadioGroup.ItemControl class="size-3.5" />+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel>All events</RadioGroup.ItemLabel></RadioGroup.Item></RadioGroup>@@ -75,6 +76,38 @@ function DisabledDemo() {}// #endregion+// #region demo:states+function StatesDemo() {+ return (+ <div class="grid gap-6">+ <For each={['sm', 'md', 'lg'] as const}>+ {(size) => (+ <RadioGroup+ defaultValue="on"+ size={size}+ aria-label={`${size} radio size`}+ >+ <RadioGroup.Item value="on">+ <RadioGroup.ItemControl />+ <RadioGroup.ItemLabel>{size}</RadioGroup.ItemLabel>+ </RadioGroup.Item>+ </RadioGroup>+ )}+ </For>+ <RadioGroup validationState="invalid" aria-label="Required selection">+ <RadioGroup.Item value="required">+ <RadioGroup.ItemControl />+ <RadioGroup.ItemLabel>Choose an option</RadioGroup.ItemLabel>+ </RadioGroup.Item>+ <RadioGroup.ErrorMessage class="text-xs text-failure">+ Select one option to continue.+ </RadioGroup.ErrorMessage>+ </RadioGroup>+ </div>+ );+}+// #endregion+export default defineDoc({name: 'RadioGroup',category: 'Inputs',@@ -95,9 +128,16 @@ export default defineDoc({id: 'horizontal',title: 'Horizontal',description:- 'The root defaults to a vertical stack; override with `flex-row` and a smaller `ItemControl` for a compact inline selector, e.g. a form footer.',+ 'The root defaults to a vertical stack. Use size="sm" and flex-row for a compact inline selector while keeping native arrow-key behavior.',render: HorizontalDemo,},+ {+ id: 'states',+ title: 'Sizes and validation',+ description:+ 'Unchecked circles stay transparent. Checked circles fill with the accent and show a contrasting dot. Size controls both the circle and its dot.',+ render: StatesDemo,+ },{id: 'disabled',title: 'Disabled',diff --git a/apps/web/src/components/ui/components/RadioGroup.tsx b/apps/web/src/components/ui/components/RadioGroup.tsxindex 5232d09370..75091db7de 100644--- a/apps/web/src/components/ui/components/RadioGroup.tsx+++ b/apps/web/src/components/ui/components/RadioGroup.tsx@@ -1,39 +1,56 @@import { RadioGroup as KobalteRadioGroup } from '@kobalte/core/radio-group';-import type { ComponentProps } from 'solid-js';-import { splitProps } from 'solid-js';+import {+ type ComponentProps,+ createContext,+ splitProps,+ useContext,+} from 'solid-js';import { cn } from '../utils/classname';-/*-<RadioGroup value={...} onChange={...}>- <RadioGroup.Item value="a">- <RadioGroup.ItemControl />- <RadioGroup.ItemLabel>Option A</RadioGroup.ItemLabel>- </RadioGroup.Item>-</RadioGroup>--A bare <RadioGroup.ItemControl /> renders its own dot indicator. It also-renders the hidden input, so don't add <RadioGroup.ItemInput /> yourself.-*/--export type RadioGroupProps = ComponentProps<typeof KobalteRadioGroup>;+export type RadioGroupSize = 'sm' | 'md' | 'lg';+export type RadioGroupProps = ComponentProps<typeof KobalteRadioGroup> & {+ size?: RadioGroupSize;+};type ItemProps = ComponentProps<typeof KobalteRadioGroup.Item>;type ItemControlProps = ComponentProps<typeof KobalteRadioGroup.ItemControl>;+type ItemIndicatorProps = ComponentProps<+ typeof KobalteRadioGroup.ItemIndicator+>;type ItemLabelProps = ComponentProps<typeof KobalteRadioGroup.ItemLabel>;-const CONTROL_CLASS = cn(- 'inline-flex items-center justify-center size-4 shrink-0 rounded-full',- 'bg-surface border-1 border-edge',- 'data-checked:border-accent',- 'data-disabled:opacity-50 data-disabled:cursor-not-allowed',- 'data-invalid:border-failure',- 'peer-focus-visible:ring-2 peer-focus-visible:ring-accent'-);+const RadioGroupSizeContext = createContext((): RadioGroupSize => 'md');+const radioSizes: Record<+ RadioGroupSize,+ { control: string; indicator: string }+> = {+ sm: { control: 'size-3.5', indicator: 'size-1.5' },+ md: { control: 'size-4', indicator: 'size-2' },+ lg: { control: 'size-5', indicator: 'size-2.5' },+};function RadioGroupItem(props: ItemProps) {const [local, rest] = splitProps(props, ['class']);return (<KobalteRadioGroup.Item- class={cn('relative inline-flex items-center gap-2', local.class)}+ class={cn(+ 'relative inline-flex items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',+ local.class+ )}+ {...rest}+ />+ );+}++function RadioGroupItemIndicator(props: ItemIndicatorProps) {+ const [local, rest] = splitProps(props, ['class']);+ const size = useContext(RadioGroupSizeContext);+ return (+ <KobalteRadioGroup.ItemIndicator+ class={cn(+ 'rounded-full bg-button-primary-ink',+ radioSizes[size()].indicator,+ local.class+ )}{...rest}/>);@@ -41,16 +58,19 @@ function RadioGroupItem(props: ItemProps) {function RadioGroupItemControl(props: ItemControlProps) {const [local, rest] = splitProps(props, ['class', 'children']);+ const size = useContext(RadioGroupSizeContext);return (<><KobalteRadioGroup.ItemInput class="peer sr-only" /><KobalteRadioGroup.ItemControl- class={cn(CONTROL_CLASS, local.class)}+ class={cn(+ 'inline-grid shrink-0 place-items-center rounded-full border border-border-secondary bg-transparent data-checked:border-accent data-checked:bg-accent data-disabled:cursor-not-allowed data-invalid:border-failure peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-accent',+ radioSizes[size()].control,+ local.class+ )}{...rest}>- {local.children ?? (- <KobalteRadioGroup.ItemIndicator class="size-2 rounded-full bg-accent" />- )}+ {local.children ?? <RadioGroupItemIndicator />}</KobalteRadioGroup.ItemControl></>);@@ -62,40 +82,34 @@ function RadioGroupItemLabel(props: ItemLabelProps) {}/**- * A Kobalte radio group with the app's control styling, composed from slots so- * the item label, description, and error message are yours to place.+ * A single choice among related values, with native radio keyboard behavior.*- * @do Give the group an `aria-label` (or a `RadioGroup.Label`) describing the- * choice.- * @do Render a `RadioGroup.ItemLabel` for every item, even when the visible- * text sits elsewhere.- * @dont Do not add `RadioGroup.ItemInput` yourself; `RadioGroup.ItemControl`- * already renders one.- * @dont Do not use a radio group for two mutually exclusive actions inline —- * that is `Tabs`.+ * @do Name the group with aria-label or RadioGroup.Label.+ * @do Render an ItemLabel for each item, even when the visible text is elsewhere.+ * @do Use the root size prop for compact or larger radio controls.+ * @dont Add ItemInput yourself; ItemControl already renders one.+ * @dont Use radios for view navigation; use Tabs.*/export const RadioGroup = Object.assign((props: RadioGroupProps) => {- const [local, rest] = splitProps(props, ['class']);+ const [local, rest] = splitProps(props, ['class', 'size']);return (- <KobalteRadioGroup- class={cn('flex flex-col gap-2', local.class)}- {...rest}- />+ <RadioGroupSizeContext.Provider value={() => local.size ?? 'md'}>+ <KobalteRadioGroup+ class={cn('flex flex-col gap-2', local.class)}+ {...rest}+ />+ </RadioGroupSizeContext.Provider>);},{- Label:- KobalteRadioGroup.Label /* passthrough — styled via class at use sites */,- Description:- KobalteRadioGroup.Description /* passthrough — styled via class at use sites */,- ErrorMessage:- KobalteRadioGroup.ErrorMessage /* passthrough — styled via class at use sites */,+ Label: KobalteRadioGroup.Label,+ Description: KobalteRadioGroup.Description,+ ErrorMessage: KobalteRadioGroup.ErrorMessage,Item: RadioGroupItem,- ItemInput:- KobalteRadioGroup.ItemInput /* passthrough — ItemControl already renders one */,+ ItemInput: KobalteRadioGroup.ItemInput,ItemControl: RadioGroupItemControl,- ItemIndicator: KobalteRadioGroup.ItemIndicator,+ ItemIndicator: RadioGroupItemIndicator,ItemLabel: RadioGroupItemLabel,ItemDescription: KobalteRadioGroup.ItemDescription,}diff --git a/apps/web/src/components/ui/components/ToggleSwitch.docs.tsx b/apps/web/src/components/ui/components/ToggleSwitch.docs.tsxindex 5e2449b91a..56754a0219 100644--- a/apps/web/src/components/ui/components/ToggleSwitch.docs.tsx+++ b/apps/web/src/components/ui/components/ToggleSwitch.docs.tsx@@ -30,7 +30,12 @@ function SizesDemo() {{(size) => (<div class="flex flex-col items-start gap-1.5"><span class="font-mono text-xs text-ink-subtle">{size}</span>- <ToggleSwitch size={size} defaultChecked />+ <ToggleSwitch+ size={size}+ defaultChecked+ label={`${size} switch`}+ labelClass="sr-only"+ /></div>)}</For>@@ -79,7 +84,12 @@ function SettingsRowDemo() {<span class="text-sm text-ink">{row.label}</span><span class="text-xs text-ink-subtle">{row.description}</span></div>- <ToggleSwitch size="md" defaultChecked={row.on} />+ <ToggleSwitch+ size="md"+ defaultChecked={row.on}+ label={row.label}+ labelClass="sr-only"+ /></div>)}</For>@@ -88,6 +98,24 @@ function SettingsRowDemo() {}// #endregion+// #region demo:form-state+function FormStateDemo() {+ return (+ <div class="flex flex-col gap-3">+ <ToggleSwitch+ name="readonly-setting"+ readOnly+ defaultChecked+ label="Read-only setting"+ />+ <ToggleSwitch validationState="invalid" label="Setting needs attention" />+ <span class="text-xs text-failure">+ This setting cannot be changed yet.+ </span>+ </div>+ );+}+// #endregionexport default defineDoc({name: 'Toggle Switch',category: 'Inputs',@@ -108,7 +136,7 @@ export default defineDoc({id: 'sizes',title: 'Sizes',description:- '`sm` is the default toolbar size; `md` is for settings rows; `xs` is for dense inline chrome.',+ '`sm` is the default toolbar size (32×16px); `md` is for settings rows (40×20px); `xs` is for dense inline chrome (28×14px).',render: SizesDemo,},{@@ -118,6 +146,13 @@ export default defineDoc({'A disabled switch dims, label included, and ignores clicks, like a disabled Checkbox.',render: DisabledDemo,},+ {+ id: 'form-state',+ title: 'Read-only and invalid',+ description:+ 'Native form props and Kobalte state remain available. Track and thumb motion respect prefers-reduced-motion.',+ render: FormStateDemo,+ },{id: 'settings-row',title: 'Settings row',diff --git a/apps/web/src/components/ui/components/ToggleSwitch.tsx b/apps/web/src/components/ui/components/ToggleSwitch.tsxindex 694bfd6031..daa99acf7d 100644--- a/apps/web/src/components/ui/components/ToggleSwitch.tsx+++ b/apps/web/src/components/ui/components/ToggleSwitch.tsx@@ -1,40 +1,42 @@-import { Switch as KobalteSwitch } from '@kobalte/core/switch';+import type { PolymorphicProps } from '@kobalte/core/polymorphic';+import {+ Switch as KobalteSwitch,+ type SwitchRootProps,+} from '@kobalte/core/switch';import type { JSX } from 'solid-js';-import { createSignal, onCleanup, Show, splitProps } from 'solid-js';+import { Show, splitProps } from 'solid-js';import { cn } from '../utils/classname';-export type ToggleSwitchProps = {- onChange?: (checked: boolean) => void;- defaultChecked?: boolean;+export type ToggleSwitchSize = 'xs' | 'sm' | 'md';+export type ToggleSwitchProps = Omit<+ PolymorphicProps<'div', SwitchRootProps<'div'>>,+ 'children'+> & {labelClass?: string;label?: JSX.Element;- disabled?: boolean;- checked?: boolean;- /** Visual size. `sm` (default) is the compact toolbar size; `md` is larger,- * used in settings rows. */- size?: 'xs' | 'sm' | 'md';- class?: string;+ /** Compact toolbar sizes are xs/sm; use md in settings rows. */+ size?: ToggleSwitchSize;controlClass?: string;};const SWITCH_SIZES = {xs: {- control: 'h-3.5 w-5.5',- thumb: 'top-0.5 left-0.5 h-2.5',- stretched: 'w-3 data-checked:translate-x-1.5',- normal: 'w-2.5 data-checked:translate-x-2',+ control: 'h-3.5 w-7',+ thumb: '-left-0.5 -top-px size-3.5 data-checked:translate-x-4',+ pressed:+ 'group-active/switch:w-4 data-checked:group-active/switch:translate-x-3.5',},sm: {- control: 'h-4 w-6',- thumb: 'top-0.5 left-0.5 h-3',- stretched: 'w-4 data-checked:translate-x-1',- normal: 'w-3 data-checked:translate-x-2',+ control: 'h-4 w-8',+ thumb: '-left-0.5 -top-px size-4 data-checked:translate-x-4.5',+ pressed:+ 'group-active/switch:w-5 data-checked:group-active/switch:translate-x-3.5',},md: {- control: 'h-5 w-9',- thumb: 'top-0.5 left-0.5 h-4',- stretched: 'w-5 data-checked:translate-x-3',- normal: 'w-4 data-checked:translate-x-4',+ control: 'h-5 w-10',+ thumb: '-left-0.5 -top-px size-5 data-checked:translate-x-5.5',+ pressed:+ 'group-active/switch:w-6 data-checked:group-active/switch:translate-x-4.5',},} as const;@@ -63,19 +65,6 @@ export const ToggleSwitch = (props: ToggleSwitchProps): JSX.Element => {'size',]);const sizing = () => SWITCH_SIZES[local.size ?? 'sm'];- const [isStretched, setIsStretched] = createSignal(false);- let stretchTimeout: ReturnType<typeof setTimeout> | undefined;-- const triggerStretch = () => {- setIsStretched(true);- if (stretchTimeout) clearTimeout(stretchTimeout);- stretchTimeout = setTimeout(() => setIsStretched(false), 75);- };-- const handleChange = (checked: boolean) => {- triggerStretch();- local.onChange?.(checked);- };// Kobalte's switch root is an inert div — only the control and the label// toggle. Forward clicks that land on the root itself (its padding/gap) to@@ -85,36 +74,32 @@ export const ToggleSwitch = (props: ToggleSwitchProps): JSX.Element => {(event.currentTarget as HTMLElement).querySelector('input')?.click();};- onCleanup(() => {- if (stretchTimeout) clearTimeout(stretchTimeout);- });-return (<KobalteSwitchclass={cn(- 'relative inline-flex items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',+ 'group/switch relative inline-flex items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',local.class)}defaultChecked={local.defaultChecked}- onChange={handleChange}+ onChange={local.onChange}disabled={local.disabled}checked={local.checked}onClick={handleRootClick}{...others}>- <KobalteSwitch.Input class="sr-only" />+ <KobalteSwitch.Input class="peer sr-only" /><KobalteSwitch.Controlclass={cn(- 'relative rounded-full bg-ink-muted/40 transition-colors duration-100 data-checked:bg-accent',+ 'relative shrink-0 rounded-full border border-border-secondary bg-border-tertiary transition-colors duration-150 ease-out data-checked:border-accent data-checked:bg-accent data-invalid:border-failure peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-accent motion-reduce:transition-none',sizing().control,local.controlClass)}><KobalteSwitch.Thumbclass={cn(- 'absolute rounded-full bg-surface transition-all duration-100 ease-in-out',+ 'absolute rounded-full border border-border-secondary bg-[white] transition-[width,translate,background-color] duration-150 ease-out data-checked:bg-accent-contrast motion-reduce:transition-none',sizing().thumb,- isStretched() ? sizing().stretched : sizing().normal+ !local.disabled && !others.readOnly && sizing().pressed)}/></KobalteSwitch.Control>diff --git a/apps/web/src/components/ui/index.ts b/apps/web/src/components/ui/index.tsindex 4250b6a566..7c2d969a26 100644--- a/apps/web/src/components/ui/index.ts+++ b/apps/web/src/components/ui/index.ts@@ -45,7 +45,7 @@ export {} from './components/Calendar';export { Card, type CardProps } from './components/Card';export type { ChatInputProps, ChatInputRows } from './components/ChatInput';-export type { CheckboxProps } from './components/Checkbox';+export type { CheckboxProps, CheckboxSize } from './components/Checkbox';export {Checkbox,InlineCheckbox,@@ -151,7 +151,7 @@ export { NumberUnitInput } from './components/NumberUnitInput';export { Panel } from './components/Panel';export type { PillButtonProps, PillButtonTone } from './components/PillButton';export { PillButton } from './components/PillButton';-export type { RadioGroupProps } from './components/RadioGroup';+export type { RadioGroupProps, RadioGroupSize } from './components/RadioGroup';export { RadioGroup } from './components/RadioGroup';export { Scroll } from './components/Scroll';export type {@@ -196,7 +196,10 @@ export type {TextFieldTextAreaProps,} from './components/TextField';export { TextField } from './components/TextField';-export type { ToggleSwitchProps } from './components/ToggleSwitch';+export type {+ ToggleSwitchProps,+ ToggleSwitchSize,+} from './components/ToggleSwitch';export { ToggleSwitch } from './components/ToggleSwitch';export type {ToolbarButtonProps,diff --git a/apps/web/src/features/block-form/components/respond/question-field.tsx b/apps/web/src/features/block-form/components/respond/question-field.tsxindex 346502b07b..b0b2624d79 100644--- a/apps/web/src/features/block-form/components/respond/question-field.tsx+++ b/apps/web/src/features/block-form/components/respond/question-field.tsx@@ -153,7 +153,7 @@ function ChoiceList(props: {onChange={(checked) => toggle(option.id, checked)}class="flex min-h-9 gap-3 rounded-lg px-2 text-sm text-ink hover:bg-hover">- <Checkbox.Control class="border-ink-extra-muted" />+ <Checkbox.Control /><Checkbox.Label class="flex min-h-9 flex-1 items-center wrap-anywhere">{option.label}</Checkbox.Label>@@ -179,7 +179,7 @@ function ChoiceList(props: {value={option.id}class="min-h-9 gap-3 rounded-lg px-2 text-sm text-ink hover:bg-hover">- <RadioGroup.ItemControl class="border-ink-extra-muted" />+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel class="flex min-h-9 flex-1 items-center wrap-anywhere">{option.label}</RadioGroup.ItemLabel>@@ -489,7 +489,7 @@ export function QuestionField(props: {props.onChange({ type: 'boolean', value: checked })}>- <Checkbox.Control class="border-ink-extra-muted" />+ <Checkbox.Control /><Checkbox.Label class="flex min-h-9 flex-1 items-center">Yes</Checkbox.Label>diff --git a/apps/web/src/features/block-form/form-pickers.tsx b/apps/web/src/features/block-form/form-pickers.tsxindex 111d510964..f171207098 100644--- a/apps/web/src/features/block-form/form-pickers.tsx+++ b/apps/web/src/features/block-form/form-pickers.tsx@@ -211,7 +211,7 @@ export function FormRelationPicker(props: RelationPickerProps) {onChange={(checked) => toggle(row.id, checked)}class="flex min-h-8 gap-2.5 rounded-md px-1.5 text-sm text-ink hover:bg-hover">- <Checkbox.Control class="border-ink-extra-muted" />+ <Checkbox.Control /><Checkbox.Label class="flex min-h-8 min-w-0 flex-1 items-center"><span class="truncate">{row.name || 'Untitled'}</span></Checkbox.Label>diff --git a/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx b/apps/web/src/features/calendar-view/components/CalendarSidebar.tsxindex 65004c3598..c27a041caa 100644--- a/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx+++ b/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx@@ -252,6 +252,7 @@ function CalendarTeamOooSection() {<CollapsibleSection.Root open={open()} onOpenChange={setOpen}><CollapsibleSection.Header><Checkbox+ size="sm"checked={calendarView.isSourceVisible(TEAM_OOO_SOURCE_ID)}onChange={(visible) =>calendarView.setSourceVisibility(TEAM_OOO_SOURCE_ID, visible)@@ -259,7 +260,7 @@ function CalendarTeamOooSection() {title="Show on calendar"class="h-full shrink-0 pr-1 pl-(--sidebar-item-inset)">- <Checkbox.Control class="size-3.5 [&_svg]:size-2.5" />+ <Checkbox.Control /><Checkbox.Label class="absolute inset-0"><span class="sr-only">Show team out of office on the calendardiff --git a/apps/web/src/features/calendar/components/SourceControls.tsx b/apps/web/src/features/calendar/components/SourceControls.tsxindex 7db5d3b35b..741e0feaf9 100644--- a/apps/web/src/features/calendar/components/SourceControls.tsx+++ b/apps/web/src/features/calendar/components/SourceControls.tsx@@ -55,12 +55,13 @@ export function SourceControls(props: SourceControlsProps) {<li class="min-w-0"><div class="relative min-w-0"><Checkbox+ size="sm"checked={allVisible()}indeterminate={someVisible()}onChange={setGroupVisible}class="flex h-(--sidebar-row-height) w-full min-w-0 gap-3 rounded-lg px-(--sidebar-item-inset) pr-9 text-sm text-ink-muted hover:bg-hover hover:text-ink touch:h-11">- <Checkbox.Control class="size-3.5 [&_svg]:size-2.5" />+ <Checkbox.Control /><Checkbox.Label class="flex min-w-0 flex-1 items-center gap-2 font-medium"><spanaria-hidden="true"@@ -96,13 +97,14 @@ export function SourceControls(props: SourceControlsProps) {<For each={group.calendars}>{(source) => (<Checkbox+ size="sm"checked={props.isVisible(source.id)}onChange={(checked) =>props.onVisibilityChange(source.id, checked)}class="flex h-(--sidebar-row-height) w-full min-w-0 gap-3 rounded-lg px-(--sidebar-item-inset) text-sm text-ink-muted hover:bg-hover hover:text-ink touch:h-11">- <Checkbox.Control class="size-3.5 [&_svg]:size-2.5" />+ <Checkbox.Control /><Checkbox.Label class="flex min-w-0 flex-1 items-center gap-2"><spanaria-hidden="true"diff --git a/apps/web/src/features/calendar/components/composer/EventForm.tsx b/apps/web/src/features/calendar/components/composer/EventForm.tsxindex 0f832dc6cb..9b6ced985a 100644--- a/apps/web/src/features/calendar/components/composer/EventForm.tsx+++ b/apps/web/src/features/calendar/components/composer/EventForm.tsx@@ -530,6 +530,7 @@ export function EventForm(props: EventFormProps) {<div class="flex shrink-0 items-center justify-end gap-3"><Show when={props.showRecurringEditNotice}><RadioGroup+ size="sm"value={editScope()}onChange={(value) => changeEditScope(value as CalendarUpdateScope)}disabled={formIsDisabled()}@@ -539,7 +540,7 @@ export function EventForm(props: EventFormProps) {<For each={RECURRING_EDIT_SCOPE_OPTIONS}>{(option) => (<RadioGroup.Item value={option.scope} class="gap-1.5">- <RadioGroup.ItemControl class="size-3.5" />+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel>{option.label}</RadioGroup.ItemLabel></RadioGroup.Item>)}diff --git a/apps/web/src/features/calendar/components/composer/RecurrenceBuilder.tsx b/apps/web/src/features/calendar/components/composer/RecurrenceBuilder.tsxindex 7db5869b9c..eb03a3d6c1 100644--- a/apps/web/src/features/calendar/components/composer/RecurrenceBuilder.tsx+++ b/apps/web/src/features/calendar/components/composer/RecurrenceBuilder.tsx@@ -1,5 +1,4 @@-import { RadioGroup } from '@kobalte/core/radio-group';-import { Button, Select } from '@ui';+import { Button, RadioGroup, Select } from '@ui';import { addMonths, format } from 'date-fns';import { createMemo, For, Show } from 'solid-js';import {@@ -168,10 +167,7 @@ export function RecurrenceBuilder(props: RecurrenceBuilderProps) {onClick={() => changeEndsKind('never')}><div class="flex flex-wrap items-center gap-2">- <RadioGroup.ItemInput />- <RadioGroup.ItemControl class="flex size-4 shrink-0 items-center justify-center rounded-full border border-edge data-checked:border-accent">- <RadioGroup.ItemIndicator class="size-2 rounded-full bg-accent" />- </RadioGroup.ItemControl>+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel class="shrink-0 font-medium text-ink">Never</RadioGroup.ItemLabel>@@ -187,10 +183,7 @@ export function RecurrenceBuilder(props: RecurrenceBuilderProps) {onClick={() => changeEndsKind('on')}><div class="flex min-w-0 flex-wrap items-center gap-2">- <RadioGroup.ItemInput />- <RadioGroup.ItemControl class="flex size-4 shrink-0 items-center justify-center rounded-full border border-edge data-checked:border-accent">- <RadioGroup.ItemIndicator class="size-2 rounded-full bg-accent" />- </RadioGroup.ItemControl>+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel class="shrink-0 font-medium text-ink">On</RadioGroup.ItemLabel>@@ -216,10 +209,7 @@ export function RecurrenceBuilder(props: RecurrenceBuilderProps) {onClick={() => changeEndsKind('after')}><div class="flex flex-wrap items-center gap-2">- <RadioGroup.ItemInput />- <RadioGroup.ItemControl class="flex size-4 shrink-0 items-center justify-center rounded-full border border-edge data-checked:border-accent">- <RadioGroup.ItemIndicator class="size-2 rounded-full bg-accent" />- </RadioGroup.ItemControl>+ <RadioGroup.ItemControl /><RadioGroup.ItemLabel class="shrink-0 font-medium text-ink">After</RadioGroup.ItemLabel>diff --git a/apps/web/src/features/entity/components/MultiSelectCheckbox.tsx b/apps/web/src/features/entity/components/MultiSelectCheckbox.tsxindex e21ffa4a8d..98e4cf6e73 100644--- a/apps/web/src/features/entity/components/MultiSelectCheckbox.tsx+++ b/apps/web/src/features/entity/components/MultiSelectCheckbox.tsx@@ -1,6 +1,5 @@-import CheckIcon from '@icon/system/regular/check.svg';-import { cn } from '@ui';-import { Show } from 'solid-js';+import { t } from '@app/lib/i18n';+import { cn, InlineCheckbox } from '@ui';interface MultiSelectCheckboxProps {checked?: boolean;@@ -9,15 +8,17 @@ interface MultiSelectCheckboxProps {}/**- * Multi-select checkbox component with responsive behavior:- * - Desktop: Always visible checkbox in left column- * - Mobile/narrow: Icon by default, checkbox on hover or when checked- * - Shows unread indicator when not checked+ * List selection toggle with a shared checkbox indicator. Layouts decide when+ * it replaces the row icon or unread indicator; the button keeps the full-cell+ * hit target and forwards shift-click selection.*/export function MultiSelectCheckbox(props: MultiSelectCheckboxProps) {return (<buttontype="button"+ role="checkbox"+ aria-checked={!!props.checked}+ aria-label={t('common.selectItem')}class="size-full relative group/button flex items-center justify-center"onMouseDown={(e) => {e.stopPropagation();@@ -28,19 +29,16 @@ export function MultiSelectCheckbox(props: MultiSelectCheckboxProps) {}}data-blocks-navigation>- <div+ <spanclass={cn(- 'size-4 p-0.5 flex items-center justify-center rounded-xs group-hover/button:border-accent group-hover/button:border pointer-events-none',- {- 'border border-edge': props.showBorder,- 'bg-accent border border-accent': props.checked,- }+ 'pointer-events-none flex items-center justify-center',+ !props.checked &&+ !props.showBorder &&+ 'opacity-0 group-hover/button:opacity-100 group-focus-visible/button:opacity-100')}>- <Show when={props.checked}>- <CheckIcon class="size-full text-surface" />- </Show>- </div>+ <InlineCheckbox checked={!!props.checked} size="md" />+ </span></button>);}diff --git a/apps/web/src/features/settings/primitives.tsx b/apps/web/src/features/settings/primitives.tsxindex 404bd0a39d..467775c459 100644--- a/apps/web/src/features/settings/primitives.tsx+++ b/apps/web/src/features/settings/primitives.tsx@@ -51,7 +51,7 @@ export function SettingsPage(props: {<divdata-settings-pagedata-drawer-scroll-body={inSheet ? true : undefined}- class="@container/settings-page h-full min-h-0 overflow-y-auto [overflow-anchor:none] select-children bg-panel [&_:has(>input[type=checkbox])]:[--color-accent:var(--color-ink)] [&_input[type=checkbox]]:accent-ink"+ class="@container/settings-page h-full min-h-0 overflow-y-auto [overflow-anchor:none] select-children bg-panel">{/* On mobile/tablet the page is full-frame: the chrome insets live inside thescroll content (plus the usual breathing room) so pages scroll underdiff --git a/apps/web/src/lib/i18n/locales/en/common.ts b/apps/web/src/lib/i18n/locales/en/common.tsindex 4baae1b9bd..14ad93b657 100644--- a/apps/web/src/lib/i18n/locales/en/common.ts+++ b/apps/web/src/lib/i18n/locales/en/common.ts@@ -11,5 +11,6 @@ export default {rename: 'Rename',more: 'More',search: 'Search',+ selectItem: 'Select item',settings: 'Settings',};diff --git a/docs/agent-guide/ui-conventions.md b/docs/agent-guide/ui-conventions.mdindex 4d4e866db6..9a83c8708d 100644--- a/docs/agent-guide/ui-conventions.md+++ b/docs/agent-guide/ui-conventions.md@@ -98,6 +98,20 @@ at the top-right and bottom-left corners. Light themes keep a soft highlightthrough those corners so they are only slightly dimmer. The iOS app also uses shared[glass press feedback](navigation.md#mobile-glass-feedback).+## Selection controls++Unchecked checkboxes and radios have transparent faces. Selected controls use the+accent fill and a contrasting mark; a partially selected checkbox uses a dash.+Checkbox marks animate on both selection and deselection. Switches have an accent+on-state and a larger rounded thumb that widens only while pressed. Reduced-motion+preferences suppress these transitions.++Use the root size prop rather than overriding the box or its glyph. Checkbox and+radio defaults stay 16px; compact list controls stay 14px. Switch toolbar and+settings sizes retain their existing geometry. Native keyboard behavior, form+values, labels, disabled/read-only state, and surrounding row hit targets stay+unchanged. See the [selection-control API contract](../../.agents/rules/web/ui-primitives.md#selection-controls).+## Multiselect dropdownsUse `Dropdown.MultiSelectItem` for filter options, not independent settings.