# Cards and lists · Divan

> A card holds one task. Rows inside are soft tiles (Item) with an icon, a title, a detail and one accessory. Tables are TanStack Table data tables with alternating row tones.

Part of Divan, the DivanWorks design system. Web page: https://brand.divanworks.com/lists · All topics: https://brand.divanworks.com/llms.txt

## Rules

- A list of things to set up (accounts, connections, platforms) is rows in a card, grouped by what they mean for the person (in use, ready to connect, not available), never a grid of cards: a row is the name, one line of detail and its status; a row that opens a sheet is a link to it (?platform=openrouter).
- Card.Root with Card.Header (Title, Description), Card.Content, Card.Footer. No borders.
- Item.Group of Item.Root rows: Item.Media variant="icon", Item.Content (Title, Description), Item.Actions.
- Empty states: Empty.Root with a title that says what will appear and one action.
- Tables: Table component inside a rounded-card bg-card p-2 wrapper with relative overflow-x-auto and scroll-fade-x.
- Loading: Skeleton shapes in the fill tone, not page-wide spinners.

## Components

### Card

One task or group on the page.

```ts
import * as Card from '#lib/components/ui/card/index.js';
```

```svelte
<Card.Root>
	<Card.Header>
		<Card.Title>Your socials</Card.Title>
		<Card.Description>Connect your Instagram and YouTube once.</Card.Description>
	</Card.Header>
	<Card.Content>…</Card.Content>
	<Card.Footer><Button>Connect</Button></Card.Footer>
</Card.Root>
```

### Item

Rows inside a card: icon, title, detail, one accessory.

```ts
import * as Item from '#lib/components/ui/item/index.js';
```

```svelte
<Item.Group>
	<Item.Root>
		<Item.Media variant="icon"><Icon name="instagram" size={16} /></Item.Media>
		<Item.Content>
			<Item.Title>Instagram</Item.Title>
			<Item.Description><bdi dir="ltr">@maryam.k</bdi></Item.Description>
		</Item.Content>
		<Item.Actions><Status tone="success">Connected</Status></Item.Actions>
	</Item.Root>
</Item.Group>
```

### Empty

Nothing here yet: say what will appear, offer one action.

```ts
import * as Empty from '#lib/components/ui/empty/index.js';
```

```svelte
<Empty.Root>
	<Empty.Header>
		<Empty.Title>Your first support shows here</Empty.Title>
		<Empty.Description>Each time you support us, it appears here.</Empty.Description>
	</Empty.Header>
	<Empty.Content><Button>Support Us</Button></Empty.Content>
</Empty.Root>
```

### DataTable

Every table of data, on TanStack Table, ending with Created and Updated (stampColumns: date and time, Tehran time). Sortable headers, optional search, pages (pageSize) or rows drawn as they scroll into view, and sort/search/page kept in the address with urlKey. Rows alternate tones; no grid lines. Tables of text pass stack, so phones show each row as a card. Persian pages pass labels={DATA_TABLE_FA} and dir="rtl". Filters kept outside the table (a bar, a Sheet) pass pageKey={view} so it returns to page 1 when they change.

```ts
import { DataTable, renderSnippet, stampColumns, type ColumnDef } from '#lib/components/ui/data-table/index.js';
```

```svelte
<script lang="ts">
	import { DataTable, renderSnippet, stampColumns, type ColumnDef } from '#lib/components/ui/data-table/index.js';
	import { Status } from '#lib/components/ui/status/index.js';

	type Donor = { id: string; name: string; total: number; status: 'Counted' | 'Held'; createdAt: string; updatedAt: string };
	let { donors }: { donors: Donor[] } = $props();

	const columns: ColumnDef<Donor>[] = [
		{ accessorKey: 'name', header: 'Donor' },
		{ accessorKey: 'status', header: 'Status', cell: ({ row }) => renderSnippet(status, row.original) },
		{ accessorKey: 'total', header: 'Total', cell: ({ row }) => row.original.total.toLocaleString('en-GB'), meta: { align: 'end' } },
		...stampColumns<Donor>({ created: (d) => d.createdAt, updated: (d) => d.updatedAt, lang: 'en' })
	];
</script>

{#snippet status(d: Donor)}<Status tone={d.status === 'Counted' ? 'success' : 'attention'}>{d.status}</Status>{/snippet}

<DataTable data={donors} {columns} getRowId={(d) => d.id} sorting={[{ id: 'total', desc: true }]} search urlKey="donors" minWidth="32rem" />
```

### Skeleton

The shape of something still loading.

```ts
import { Skeleton } from '#lib/components/ui/skeleton/index.js';
```

```svelte
<Skeleton class="h-4 w-2/5" />
```

### Avatar

A person on a board or in a list.

```ts
import * as Avatar from '#lib/components/ui/avatar/index.js';
```

```svelte
<Avatar.Root size="sm"><Avatar.Fallback>M</Avatar.Fallback></Avatar.Root>
```
