# 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.

Section: Blocks / Layouts
Page: https://ui.heyramzi.com/components/section-card
Import path: `@heyramzi/ui/components/section-card`

## Import

```ts
import { SectionCard } from "@heyramzi/ui/components/section-card";
import { SectionHeader } from "@heyramzi/ui/components/section-header";
import { FieldRow } from "@heyramzi/ui/components/field-row";
import { Button } from "@heyramzi/ui/shadcn/button";
import { Input } from "@heyramzi/ui/shadcn/input";
```

## Usage

```svelte
<SectionCard title="General">
  {#snippet actions()}
    <button type="button">Reset</button>
  {/snippet}
  <p>The section's rows go here.</p>
</SectionCard>
```

## Demo

```svelte
<script lang="ts">
	import { SectionCard } from "@heyramzi/ui/components/section-card";
	import { SectionHeader } from "@heyramzi/ui/components/section-header";
	import { FieldRow } from "@heyramzi/ui/components/field-row";
	import { Button } from "@heyramzi/ui/shadcn/button";
	import { Input } from "@heyramzi/ui/shadcn/input";

	let name = $state("Brightwell Studio");
</script>

<div class="flex w-full max-w-2xl flex-col gap-6">
	<SectionHeader title="Workspace" count={2} countLabel="settings" />
	<SectionCard title="General">
		{#snippet actions()}
			<Button size="sm" variant="outline">Reset</Button>
		{/snippet}
		<FieldRow
			label="Workspace name"
			for="workspace-name"
			description="Shown on invoices and the sign-in page."
		>
			<Input id="workspace-name" bind:value={name} />
			{#snippet action()}
				<Button disabled={name.trim() === ""}>Save</Button>
			{/snippet}
		</FieldRow>
	</SectionCard>
</div>
```

## API

### SectionCard

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `title` | `string` |  | required |
| `actions` | `Snippet` |  | Controls at the far end of the header. |
| `flush` | `boolean` | `false` | No padding in the body, so a table runs edge to edge under the header. |
| `class` | `string` |  |  |
| `children` | `Snippet` |  | required |

### SectionHeader

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `title` | `string` |  | required |
| `count` | `number` |  | How many things the section holds. Drawn as a chip next to the title. |
| `countLabel` | `string` | `"items"` | What the count counts, for a screen reader: "lines". |
| `description` | `string` |  | One line under the title. |
| `actions` | `Snippet` |  | A control at the far end of the row. |
| `level` | `2 \| 3` | `2` | The heading level. Sections under a page title are 2. |

### FieldRow

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `label` | `string` |  | required |
| `for` | `string` |  | required. Id of the control, so the label focuses it. |
| `description` | `string` |  |  |
| `error` | `string` |  |  |
| `class` | `string` |  |  |
| `children` | `Snippet` |  | required. The control: an Input, a Select trigger. It takes the width the action leaves. |
| `action` | `Snippet` |  | The button that acts on the control. Same height as the control, bottom of the row. |
