# Settings group

The one settings anatomy: a label outside the card, rows of name, state and control in shared columns; a `Notice` inside it is a row of the card.

Live variants: https://design.arcadia.is/components/settings-group

```tsx
import { SettingsGroup, SettingsRow, revealSetting } from "@arcadia/ui";
```

Set a theme or toggle a preference. Hairlines separate the rows without tracing the group.

```tsx
import {
  SettingsGroup, SettingsRow, SegmentedControl, Switch,
} from "@arcadia/ui";

<SettingsGroup label="Appearance">
  <SettingsRow label="Theme"
    control={<SegmentedControl size="md" aria-label="Theme" defaultValue="system"
      items={[{ value: "system", label: "System" }, { value: "light", label: "Light" }, { value: "dark", label: "Dark" }]} />} />
  <SettingsRow label="Reduce motion" control={<Switch hideLabel label="Reduce motion" />} />
  <SettingsRow label="Keep the cache warm" hint="Sends a short request before the cache expires, so the next message costs less."
    control={<Switch hideLabel label="Keep the cache warm" />} />
</SettingsGroup>
```

## Accessibility

A group is a `section` labelled by its heading, so a screen reader can jump between groups. A row is plain structure: the control inside carries its own name (`hideLabel` on a switch still names it), and an `error` is announced with `role="alert"`. A row that opens something is itself the link or the button, named by its text, its chevron or its external arrow drawn; one that also holds a switch is a link or a button named by its label and described by its second line, then the switch, two stops in that order. A group's `note` describes its section and is no part of its name. A `hint` is a button after the label, before the control in the tab order, and its text is its description. A row's `fold` is a disclosure button after its second line, before the control in the tab order: it reports `aria-expanded`, and its closed list stays in the page for find in page, which opens it. A group's `footnote` describes the group's section. A warning notice is a `status`, a danger notice an `alert`. A row found by `revealSetting` moves focus to its control, so Space or an arrow acts at once; under reduced motion the wash is a ring for the same time instead. A control on the label's line carries its own name, as a row's control does.

## API reference

### SettingsGroup

- `nesting` (`"contained-object"`): A separately framed object that belongs inside another one, not a layout wrapper.
- `label` (`ReactNode`)
- `note` (`ReactNode`)
- `hint` (`string`)
- `action` (`ReactNode`)
- `toolbar` (`ReactNode`)
- `settingId` (`string`)
- `footnote` (`ReactNode`)
- `collapsible` (`boolean`, default `false`)
- `defaultOpen` (`boolean`, default `true`)
- `dense` (`boolean`, default `false`)
- `flush` (`boolean`, default `false`)
- `danger` (`boolean`, default `false`)
- `fill` (`boolean`, default `false`)
- `id` (`string`)
- `rootStyle` (`RootStyle`): A component's typed override prop: `Layout` and its documented knobs, each the references it takes or another kit knob of its kind; anything else is a type error at the call site (STYLEX.md).

### SettingsRow

- `aria-current` (`AriaAttributes["aria-current"]`)
- `leading` (`ReactNode`)
- `label` (`ReactNode`, required)
- `hint` (`string`)
- `meta` (`ReactNode`)
- `metaWraps` (`boolean`, default `false`)
- `fold` (`{ label: string; content: ReactNode }`)
- `value` (`ReactNode`)
- `valueWraps` (`boolean`, default `false`)
- `readout` (`boolean`, default `false`)
- `control` (`ReactNode`)
- `wide` (`boolean`, default `false`)
- `href` (`string`)
- `external` (`boolean`, default `false`)
- `onOpen` (`() => void`)
- `menu` (`ReactNode`)
- `error` (`ReactNode`)
- `align` (`"center" | "start"`, default `"center"`)
- `dim` (`boolean`, default `false`)
- `settingId` (`string`)
