Skip to main content

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​

Storybook

Without Help​

Storybook

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​

VariantWhat it is
any controlSwitch, 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​

PropTypeDefaultDescription
label *string—Setting name, left column
helpstringnoneExplanation 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>
KindNameDescription
attributelabelSetting name, left column
attributehelpExplanation under the label; default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
slot(default)The control, right column. Give it its own accessible label.