SettingsRow
Pairs a label and description with a control at the end of the row, stacking in narrow containers.
- Frameworks
- Astro · React · Elements · Dioxus
- Registry
lumen add SettingsRow- Interaction
- Native markup
See it and copy it
Framework example
Choose Astro, React, Elements, or Dioxus to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.
Preferences
Changes apply to this device.
Uses mobile data when Wi-Fi is unavailable.
The view that opens when you launch the app.
Follow the system or pick a fixed theme.
Download a copy of your notes as Markdown.
View SettingsRow code
Framework usage
Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React, Elements, and Dioxus use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.---
import { Button, Card, NativeSelect, SectionHeader, Segmented, SettingsRow, Switch } from '@santi020k/lumen-astro'
---
<Card>
<SectionHeader
description="Changes apply to this device."
headingLevel={3}
title="Preferences"
/>
<SettingsRow
controlId="sync-cellular"
description="Uses mobile data when Wi-Fi is unavailable."
label="Sync over cellular"
>
<Switch aria-describedby="sync-cellular-description" id="sync-cellular" />
</SettingsRow>
<SettingsRow
controlId="start-page"
description="The view that opens when you launch the app."
label="Start page"
>
<NativeSelect
aria-describedby="start-page-description"
id="start-page"
options={['Inbox', 'Today', 'Projects']}
/>
</SettingsRow>
<SettingsRow
controlId="appearance"
description="Follow the system or pick a fixed theme."
label="Appearance"
>
<Segmented
aria-describedby="appearance-description"
aria-labelledby="appearance-label"
defaultValue="System"
name="appearance"
options={['System', 'Light', 'Dark']}
/>
</SettingsRow>
<SettingsRow
controlId="export-data"
description="Download a copy of your notes as Markdown."
label="Export data"
>
<Button
aria-describedby="export-data-description"
id="export-data"
size="sm"
variant="secondary"
>
Export
</Button>
</SettingsRow>
</Card>import { Button, Card, NativeSelect, SectionHeader, Segmented, SettingsRow, Switch } from '@santi020k/lumen-react'
export const Example = () => (
<Card>
<SectionHeader description="Changes apply to this device." headingLevel={3} title="Preferences" />
<SettingsRow description="Uses mobile data when Wi-Fi is unavailable." label="Sync over cellular">
{control => <Switch {...control} />}
</SettingsRow>
<SettingsRow description="The view that opens when you launch the app." label="Start page">
{control => <NativeSelect {...control} options={['Inbox', 'Today', 'Projects']} />}
</SettingsRow>
<SettingsRow description="Follow the system or pick a fixed theme." label="Appearance">
{control => <Segmented {...control} defaultValue="System" name="appearance" options={['System', 'Light', 'Dark']} />}
</SettingsRow>
<SettingsRow description="Download a copy of your notes as Markdown." label="Export data">
{control => <Button {...control} size="sm" variant="secondary">Export</Button>}
</SettingsRow>
</Card>
)<script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<lumen-card>
<lumen-settings-row>
<div data-slot="settings-row-content">
<label data-slot="settings-row-label" for="sync-cellular" id="sync-cellular-label">Sync over cellular</label>
<p data-slot="settings-row-description" id="sync-cellular-description">Uses mobile data when Wi-Fi is unavailable.</p>
</div>
<div data-slot="settings-row-control">
<lumen-switch aria-describedby="sync-cellular-description" id="sync-cellular"></lumen-switch>
</div>
</lumen-settings-row>
<lumen-settings-row>
<div data-slot="settings-row-content">
<span data-slot="settings-row-label" id="appearance-label">Appearance</span>
<p data-slot="settings-row-description" id="appearance-description">Follow the system or pick a fixed theme.</p>
</div>
<div data-slot="settings-row-control">
<lumen-segmented aria-describedby="appearance-description" aria-labelledby="appearance-label">
<label class="ui-segmented__option"><input checked class="ui-segmented__input" name="appearance" type="radio" value="system"><span class="ui-segmented__label">System</span></label>
<label class="ui-segmented__option"><input class="ui-segmented__input" name="appearance" type="radio" value="light"><span class="ui-segmented__label">Light</span></label>
<label class="ui-segmented__option"><input class="ui-segmented__input" name="appearance" type="radio" value="dark"><span class="ui-segmented__label">Dark</span></label>
</lumen-segmented>
</div>
</lumen-settings-row>
</lumen-card>use dioxus::prelude::*;
use lumen_dioxus::prelude::*;
#[component]
fn Example() -> Element {
let mut dark = use_signal(|| false);
rsx! {
SettingsRow {
control: move |control: SettingsRowControlProps| rsx! {
Switch {
aria_describedby: control.aria_describedby,
aria_labelledby: control.aria_labelledby,
checked: dark(),
id: control.id,
onchange: move |next: bool| dark.set(next),
}
},
description: "Use dark colors everywhere.",
label: "Dark mode",
}
}
}Framework differences
React: Pass the control as a function child, for example {control => <Switch {...control} />}, and the row supplies id, aria-labelledby, and aria-describedby.
Elements: Author the parts with data-slot. Give the label for and id, give the description an id, and set id and aria-describedby on the control yourself.
Choose your target
Add this component
Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.
pnpm add @santi020k/lumen-astrolumen add SettingsRowpnpm add @santi020k/lumen-reactlumen add SettingsRow --target reactpnpm add @santi020k/lumen-elementslumen add SettingsRow --target elementsAPI reference
Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.
| Attribute | Values | Default | Description |
|---|---|---|---|
| label | string | ReactNode / label slot | required | Visible label. With controlId it renders a label element pointing at the control, so it becomes the control’s accessible name. |
| description | string | ReactNode / description slot | - | Supporting sentence under the label. Its id is the controlId followed by -description; reference it from the control’s aria-describedby. |
| controlId | string | - | Id of the control. The label id is the controlId followed by -label, and the description id is the controlId followed by -description. |
| leading | ReactNode / leading slot | - | Adds an icon or graphic before the text. Mark decorative icons as hidden. |
| children | control | default slot | (control: SettingsRowControlProps) => ReactNode | - | The control at the end of the row. In React, pass a function to receive id, aria-labelledby, and aria-describedby and spread them on the control, so the row wires it without controlId. |
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
| ...native attributes | HTML attributes | - | Forwards standard attributes to the root element unless the component consumes them. |
Customize SettingsRow
Start with semantic theme tokens and a class on the public component. Keep its accessible name, focus treatment, and interaction state intact.
.product-settings-row {
--surface: 0 0% 100%;
--ink: 220 20% 15%;
--line: 220 15% 82%;
}Apply product-settings-row through Astro's class, React's className, or the custom element's class. Verify foreground and background contrast in both schemes.
| Hook | Values | Default | Contract |
|---|---|---|---|
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
Use the documented hooks above and adapter types when targeting component states. Theme guide · Accessibility verification scope