Divan

Components

Cards and lists

A card holds one task. Rows inside it are soft tiles with an icon, a title, a detail and one accessory. Tables are data tables: sortable, searchable, rows in alternating tones.

A card with rows

Your socials

Connect your Instagram and YouTube to your account once. It counts in every round.

Instagram

@maryam.k

Connected
YouTube

Counts after you subscribe

Your first support shows here
Each time you support us, it appears here with your place on the board.

A list of things to set up (accounts, connections) is rows like these, grouped by what they mean for the person, never a grid of cards; a row that opens a sheet is a link to it.

Links in a list

Board

  1. 1
    M
    Maryam K. 2,400,000 toman
  2. 2
    A
    Arash 1,150,000 toman
  3. 3
    N
    Niloufar R. 900,000 toman

Ranks and amounts use tabular figures. Example names and amounts.

Backoffice table

  • Instagram
    Comment
    Example: When is the next episode?
    Status
    Replied
    Created
    Updated
  • YouTube
    Comment
    Example: Can I support from abroad?
    Status
    Needs a person
    Created
    Updated
  • Instagram
    Comment
    Example: Beautiful work
    Status
    Sending
    Created
    Updated
  • Instagram
    Comment
    Example: ❤️
    Status
    Skipped
    Created
    Updated
Comment
InstagramExample: When is the next episode? Replied
YouTubeExample: Can I support from abroad? Needs a person
InstagramExample: Beautiful work Sending
InstagramExample: ❤️ Skipped

Loading

While something loads, its shape is shown in the fill tone; no spinners over whole pages.

Code

Card · One task or group on the page.

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

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

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

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

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

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

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

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

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

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