Settings form
Groups of fields described by data, rendered as one plain HTML form.
Last updated
Show codeHide code
<SettingsForm layout="two-column" action="/settings" groups={[{ heading, description?, fields: [{ kind: 'input' | 'select' | 'switch' | 'textarea', name, label, hint?, options?, value?, required?, type? }] }]} cancelLabel="Reset" />Add
npx @ava-ui/apogee add settings-form
API
| Prop | Type | Default | Category | Description |
|---|---|---|---|---|
groups |
{ heading, description?, fields }[] |
— | content | Each field: kind, name, label, hint?, options? (select), value? ('on' checks a switch), required?, type? (input). |
action, method |
string, 'get' | 'post' |
—, 'post' |
content | Passed to the form. |
submitLabel |
string |
'Save changes' |
content | |
cancelLabel |
string |
— | content | Shows a reset button. |
label |
string |
'Settings' |
content | Landmark name. |
layout |
'stacked' | 'two-column' |
'stacked' |
layout | Two-column puts the group heading beside its fields. |
spacing, headingLevel, id |
spacing is small |
layout |
Layouts
Show codeHide code
<SettingsForm layout="stacked" groups={…} />Accessibility
- Each group is a
fieldsetlabelled by its heading; every control has a visible label; the form submits without JS.