Forms

SettingRow

Settings-page row: label, raw key and guidance with save status, errors and policy under them; its control sits at right, then stacks at its container's automatic or public tablet breakpoint.

import { SettingRow } from '@lostgradient/cinder';
formsettings
01

Overview

Reference usage

SettingRow arranges settings-page guidance and a control while publishing FormField context to composed Input, Toggle, or Select controls. It supports advisory, error, managed-policy, and optional disclosure content without duplicating those semantics at each call site.

Usage

svelte
<script lang="ts">
  import { Input } from '@lostgradient/cinder';
  import { SettingRow } from '@lostgradient/cinder';
</script>

<SettingRow id="display-name" label="Display name" description="Shown to collaborators.">
  {#snippet control()}
    <Input id="display-name" value="" placeholder="Ada Lovelace" />
  {/snippet}
</SettingRow>

SettingRow requires a stable id, label, and control snippet. warning is advisory and error is corrective; FormField renders both messages itself as siblings of the control, and exposes only warningId/errorId/describedBy/invalid through context—a custom control that reads that context associates with the messages, it doesn't receive their text. Use managed with PolicyLock when a policy owns the value. The row does not save settings or disable a control automatically—pass disabled to the row or control when the host is submitting or unavailable.

One save model

A setting saves when the person leaves its field and shows what happened on its own row; there is no page-level Save. The label, the raw key (identifier, small and monospaced, outside the label so it stays out of the accessible name) and the description sit on the left with the status line, the error and the managed line under them, and the control on the right. Below 30rem of row width the control stacks under the label.

  • status draws one of five lines in a polite live region that is always mounted: saving ("Saving…", spinning glyph), saved ("Saved just now", success tone), restart ("Applies after restart", restart glyph), saved-restart ("Saved, waiting for a restart", amber dot) and reverted ("Reverted, in effect now", muted, no glyph), for a change that waited for a restart and was put back. statusLabel replaces the words.
  • error marks the control invalid and says what is wrong at the field: an invalid value ("Enter a number from 1 to 3650. Nothing was saved.") or a failed save. onRetry adds a quiet "Try again" beside a failed save; the value stays in the field.
  • loadError says that what the control offers did not load, such as the options of a select ("Couldn't load the models. Try again"). It is an advisory in the warning tone, so the control is not marked invalid, and it takes the place of warning while it is set. With onRetry it ends in the same quiet "Try again" as a failed save, named by retryLabel, which repeats a read or a save (a job that failed and is run again, such as "Retry delivery", names its own thing); while error is also set, that "Try again" stays beside the error.
  • managed with a message draws a locked setting with the lock glyph. The control is the page's to make read-only.
Live preview

Settings row

Shown to collaborators.

02

When to use

Use when
  • Pairing a setting label and guidance with an Input, Toggle, or Select control that saves as the person leaves it.
  • A setting needs to say where its save has got to (Saving, Saved, Applies after restart) or that it is locked by policy.
Avoid when
  • The control belongs in a conventional stacked form field.
03

Examples

Settings row

Compose a labelled setting control with guidance.

Save status, failure and lock

A setting saves when you leave the field and says where it has got to on its own row: Saving, Saved, Applies after restart, Saved waiting for a restart. An invalid value fails at its field and nothing is saved; a failed save keeps the value and offers a quiet Retry; a locked setting says why with a lock glyph. Below a container width the control stacks under the label.

04

Props

Props for setting-row
Name
Type
Default
Description
id required text Stable id forwarded into FormField context, which associates the generated <label for={id}> with it. Only a control that opts into and reads that context receives id automatically—for a native element or a third-party component that doesn't, the label is unassociated unless the host also applies id to that control directly, the same qualification as required and disabled.
label required text Visible setting label.
identifier text The raw key behind the label, drawn small and monospaced beside it ("engine.maxConcurrentRuns"). It sits outside the <label>, so it never becomes part of the control's accessible name.
description text Guidance text describing the setting.
descriptionAction snippet Rendered after the description inside the same paragraph, so it joins aria-describedby: a quiet link such as "Open Health". Shown only with description.
warning text Advisory message. FormField renders this text itself, as a sibling of the control, not through context—a custom control that reads FormField context sees only the derived warningId (and the composed describedBy) to associate with, never the message string itself.
error text Corrective error message. FormField renders this text itself, as a sibling of the control, not through context—a custom control that reads FormField context sees only the derived errorId, invalid, and the composed describedBy, never the message string itself.
status 'saving''saved''restart''saved-restart''reverted' Where the setting's own save has got to: saving, saved, restart, saved-restart or reverted. It draws a status line under the description, in a polite live region that is always mounted, so a change from Saving to Saved is announced. Leave it unset for a setting at rest. Pair it with error for the failures: an invalid value or a save that did not go through.
statusLabel text Replaces the words of the status line, such as "Saved 2 minutes ago" for saved. The glyph and tone still follow status.
onRetry () => void Called by the quiet Try again beside the error, for a save that did not go through ("Couldn't save. Your value is still in the field. Try again"), and beside loadError, for a read that did not. Leave it unset for an invalid value, where retrying changes nothing and the person fixes the field instead.
retryLabel text 'Try again' Label of the retry action drawn beside the error or the load error when onRetry is set.
loadError text Says that what the row's control offers did not load ("Couldn't load the models. Try again"), such as the options of a select. It is an advisory, in the warning tone and not the error's, so the control is not marked invalid, and it takes the place of warning while it is set. With onRetry it ends in the same quiet Try again the error has. While error is also set, the Try again stays beside the error, which onRetry is for.
required boolean false Renders the required marker and forwards required into FormField context. Only takes effect for a control that opts into and reads that context—it never adds a native required attribute, so a control that doesn't consume the context still passes browser constraint validation and must receive required directly. SettingRow forwards undefined when omitted; FormField normalizes that to false. Defaults to false.
disabled boolean false Forwards a disabled state into FormField context for the row's control. Only takes effect for a control that opts into and reads that context—a native element or a third-party component that doesn't consume it stays interactive and must receive disabled directly. Does not disable automatically while saving. SettingRow forwards undefined when omitted; FormField normalizes that to false. Defaults to false.
managed FormFieldManaged Renders a managed-policy line with a lock glyph; pair with PolicyLock. Give it a message for a locked setting ("Locked by your deployment (remote mode). Change it in the deployment's configuration."). The control stays the page's to make read-only.
controlWidth text The width of the column the control sits in, as a CSS length ("25rem"). Leave it unset for the default of 15rem, which fits a switch, a short field or a select; give a control that needs more room, such as the address of a feed or a list of switches, its own. Below the container width where the row stacks, the control takes the row's width whatever this says.
controlAlign 'end' | 'stretch' 'end' Where the control sits in its column. end (the default) sizes the control to its content and puts it at the inline end, which suits a switch or a button. stretch makes the control fill the column, so text-entry controls (a field, a select, a number) share one leading edge and one width down a list of rows.
stacked boolean false Stacks the control under its explanatory copy. The owning page decides when to apply this state; the automatic 30rem container fallback still applies when it is omitted.
control required snippet The setting's control, rendered with FormField context applied.
disclosure snippet Optional disclosure content rendered beneath the row.