Section card
A settings page kit: a panel with a 44px header and a line under it, a section header with a count chip, and a field row whose action sits at the control's height.
Workspace 2
General
Shown on invoices and the sign-in page.
Installation
pnpm add @heyramzi/uiUsage
import { SectionCard } from "@heyramzi/ui/components/section-card";<SectionCard title="General">
{#snippet actions()}
<button type="button">Reset</button>
{/snippet}
<p>The section's rows go here.</p>
</SectionCard>Keyboard and accessibility
- The section card's title is an h3. SectionHeader's title is an h2 unless you set level.
- FieldRow ties its label to the control through for, and links the description or error to it.
- An error marks the control invalid and is read out as an alert.
API reference
SectionCard
titlerequiredstringactionsSnippet- Controls at the far end of the header.
flushboolean- Default
false - No padding in the body, so a table runs edge to edge under the header.
classstringchildrenrequiredSnippet
| Prop | Type | Default |
|---|---|---|
title required | string | |
actions Controls at the far end of the header. | Snippet | |
flush No padding in the body, so a table runs edge to edge under the header. | boolean | false |
class | string | |
children required | Snippet |
SectionHeader
titlerequiredstringcountnumber- How many things the section holds. Drawn as a chip next to the title.
countLabelstring- Default
"items" - What the count counts, for a screen reader: "lines".
descriptionstring- One line under the title.
actionsSnippet- A control at the far end of the row.
level2 | 3- Default
2 - The heading level. Sections under a page title are 2.
| Prop | Type | Default |
|---|---|---|
title required | string | |
count How many things the section holds. Drawn as a chip next to the title. | number | |
countLabel What the count counts, for a screen reader: "lines". | string | "items" |
description One line under the title. | string | |
actions A control at the far end of the row. | Snippet | |
level The heading level. Sections under a page title are 2. | 2 | 3 | 2 |
FieldRow
labelrequiredstringforrequiredstring- Id of the control, so the label focuses it.
descriptionstringerrorstringclassstringchildrenrequiredSnippet- The control: an Input, a Select trigger. It takes the width the action leaves.
actionSnippet- The button that acts on the control. Same height as the control, bottom of the row.
| Prop | Type | Default |
|---|---|---|
label required | string | |
for required Id of the control, so the label focuses it. | string | |
description | string | |
error | string | |
class | string | |
children required The control: an Input, a Select trigger. It takes the width the action leaves. | Snippet | |
action The button that acts on the control. Same height as the control, bottom of the row. | Snippet |