SettingRow
BasicLayout
<co-setting-row>SettingRow is the two-column settings row: label and help on the left, control on the right.
import { SettingRow } from 'health-components';
Examples
Showcase
Without Help
Usage
<SettingRow label="Density" help="Compact fits more rows."><SegmentedControl options={["Comfortable", "Compact"]} /></SettingRow>
When to use
- Settings pages.
When not to use
- Data entry forms: fields in a grid.
Variants and states
| Variant | What it is |
|---|---|
| any control | Switch, Select, TextField. |
Accessibility
- Label the control itself too.
Do and don't
- Do: One setting per row.
- Don't: Hide what a setting does.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label * | string | — | Setting name, left column |
help | string | none | Explanation under the label |
children * | ReactNode | — | The control, right column. Give it its own accessible label. |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-setting-row>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-setting-row label="…" help="…" [defaultValue]="defaultValue">…</co-setting-row>
| Kind | Name | Description |
|---|---|---|
| attribute | label | Setting name, left column |
| attribute | help | Explanation under the label; default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| slot | (default) | The control, right column. Give it its own accessible label. |