Duolith docs

kit

A gallery of the built-in kit, one page per family (buttons, lists and cards, inputs, selection controls, feedback and states), every variant, size and state, light and dark, two columns on a wide window.

Run it

cargo run -p duolith-cli -- dev examples/kit     # live, reloads on save
cargo run -p duolith-cli -- build examples/kit   # static output in examples/kit/dist

The folder on the web: examples/kit.

Features it shows

FeatureWhereScreenshot
<piece> (leading and trailing content)kit pages/lists.duokit-lists.png
Button, IconButtongallery pages/kit-core.duo; kit pages/buttons.duogallery-kit-core.png, kit-buttons.png
ListRow, Sectiongallery pages/kit-core.duo; kit pages/lists.duogallery-kit-core.png, kit-lists.png
TextField, TextAreagallery pages/kit-core.duo; kit pages/inputs.duogallery-kit-core-fields.png, kit-inputs.png
ToggleRow, Checkbox, RadioGroupgallery pages/kit-core.duo; kit pages/selection.duogallery-kit-core-selection.png, kit-selection.png
EmptyState, ErrorStategallery pages/kit-core.duo; kit pages/feedback.duogallery-kit-core-feedback.png, kit-feedback.png
Accordion (expanded), Banner, Pager, Pagination, Rating, ProgressRingkit pages/more.duokit-more.png
Combobox (a WAI-ARIA combobox over a listbox), ChipInput, DataTable (a table with sorted, aria-sort), FileInput, ActionSheet, Fabkit pages/more.duokit-more.png
on:swipe; Pager paging on a swipe; SwipeRow, PullToRefresh, Drawer (decision 0121)kit pages/more.duokit-more.png
DateRangePicker (a start, then an end, the days between marked)kit pages/more.duokit-more.png

Source

components/Header.duo
---
import { props } from "@duolith/client";

let { title, subtitle } = props<{ title: string; subtitle?: string }>();
---

<view class="gap-2">
  <view href="/" class="back row items-center gap-1 self-start text-primary">
    <icon name="chevron-left" />
    <text class="text-label">Kit</text>
  </view>
  <text role="heading" class="text-title text-ink">{title}</text>
  <show when={subtitle}>
    <text class="text-body text-muted">{subtitle}</text>
  </show>
</view>

<style>
  .back {
    min-height: 32px;
  }
</style>
pages/buttons.duo
---
import { state } from "@duolith/client";
import { Button, Card, IconButton } from "@duolith/kit";
import Header from "../components/Header.duo";

let presses = state(0);
let saving = state(false);
let liked = state(false);

const save = () => {
  saving = true;
  setTimeout(() => (saving = false), 1500);
};
---

<screen title="Buttons" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <Header title="Buttons" subtitle={`Button and IconButton. Pressed ${presses} times.`} />

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Card title="Variants" subtitle="primary, secondary, ghost, danger">
          <view class="gap-3">
            <Button label="Primary" onPress={() => presses++} />
            <Button label="Secondary" variant="secondary" onPress={() => presses++} />
            <Button label="Ghost" variant="ghost" onPress={() => presses++} />
            <Button label="Delete" variant="danger" icon="trash" onPress={() => presses++} />
          </view>
        </Card>

        <Card title="Sizes" subtitle="sm, md, lg">
          <view class="row wrap items-center gap-3">
            <Button label="Small" size="sm" />
            <Button label="Medium" />
            <Button label="Large" size="lg" />
          </view>
          <view class="row wrap items-center gap-3">
            <Button label="Small" size="sm" variant="secondary" />
            <Button label="Medium" variant="secondary" />
            <Button label="Large" size="lg" variant="secondary" />
          </view>
        </Card>
      </view>

      <view class="column gap-6">
        <Card title="States" subtitle="loading, disabled, full width">
          <view class="gap-3">
            <Button
              label={saving ? "Saving" : "Save"}
              icon="check"
              loading={saving}
              full
              onPress={save}
            />
            <Button label="Disabled" disabled full />
            <Button label="Disabled" variant="secondary" disabled full />
            <Button label="Loading" variant="secondary" loading full />
          </view>
        </Card>

        <Card title="Icons" subtitle="icon before, iconEnd after">
          <view class="row wrap gap-3">
            <Button label="New post" icon="plus" />
            <Button label="Next" iconEnd="arrow-right" variant="secondary" />
            <Button label="Share" icon="share" variant="ghost" />
          </view>
        </Card>

        <Card title="IconButton" subtitle="always labelled for assistive technology">
          <view class="row wrap items-center gap-2">
            <IconButton icon="search" label="Search" />
            <IconButton icon="bell" label="Notifications" variant="secondary" />
            <IconButton icon="plus" label="Add" variant="primary" />
            <IconButton icon="trash" label="Delete" variant="danger" />
            <IconButton
              icon="heart"
              label="Like"
              selected={liked}
              onPress={() => (liked = !liked)}
            />
            <IconButton icon="settings" label="Settings" disabled />
          </view>
          <view class="row wrap items-center gap-2">
            <IconButton icon="close" label="Close" size="sm" variant="secondary" />
            <IconButton icon="close" label="Close" variant="secondary" />
            <IconButton icon="close" label="Close" size="lg" variant="secondary" />
          </view>
        </Card>
      </view>
    </view>
  </view>
</screen>

<style>
  .page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
  .column {
    flex: 1;
    min-width: 0;
  }
</style>
pages/feedback.duo
---
import { state } from "@duolith/client";
import { Button, Card, EmptyState, ErrorState, ProgressBar, Slider, Spinner } from "@duolith/kit";
import Header from "../components/Header.duo";

let percent = state(35);
let retrying = state(false);
let attempts = state(0);
let items = state<string[]>([]);

const retry = () => {
  retrying = true;
  setTimeout(() => {
    retrying = false;
    attempts++;
  }, 1200);
};
---

<screen title="Feedback and states" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <Header
      title="Feedback and states"
      subtitle="Spinner, ProgressBar, EmptyState and ErrorState."
    />

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Card title="Spinner" subtitle="sm, md, lg; role status">
          <view class="row items-center gap-6 text-primary">
            <Spinner size="sm" />
            <Spinner />
            <Spinner size="lg" />
            <view class="text-muted">
              <Spinner label="Syncing" />
            </view>
          </view>
        </Card>

        <Card title="ProgressBar" subtitle="a value from 0 to 1, or none while unknown">
          <ProgressBar label="Uploading" value={percent / 100} showValue />
          <Slider label="Set progress" unit="%" bind:value={percent} />
          <ProgressBar label="Preparing" />
          <ProgressBar label="Backed up" value={1} tone="success" showValue />
          <ProgressBar label="Storage almost full" value={0.92} tone="danger" showValue />
        </Card>
      </view>

      <view class="column gap-6">
        <Card flat>
          <show when={items.length > 0}>
            <text class="text-body text-ink">{items.join(", ")}</text>
            <Button label="Clear" variant="secondary" onPress={() => (items = [])} />
          </show>
          <otherwise>
            <EmptyState
              title="No messages yet"
              message="When someone writes to you, their message appears here."
              icon="inbox"
              action="Write a message"
              onAction={() => (items = ["Hello from the kit"])}
            />
          </otherwise>
        </Card>

        <Card flat>
          <ErrorState
            message={`We could not load your feed. Tried ${attempts} times.`}
            retrying={retrying}
            onRetry={retry}
          />
        </Card>

        <Card flat>
          <ErrorState
            title="You are offline"
            icon="wifi-off"
            message="Connect to the internet to see new posts."
          />
        </Card>
      </view>
    </view>
  </view>
</screen>

<style>
  .page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
  .column {
    flex: 1;
    min-width: 0;
  }
</style>
pages/index.duo
---
import { Avatar, Badge, ListRow, Section } from "@duolith/kit";
---

<screen title="Kit gallery" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <view class="row items-center gap-3">
      <Avatar name="Duolith Kit" size="lg" />
      <view class="grow gap-1">
        <text role="heading" class="text-title text-ink">Kit gallery</text>
        <text class="text-body text-muted">Every part, variant, size and state.</text>
      </view>
    </view>

    <Section
      title="Families"
      footer="Each page works in light and dark, and lays out in two columns on a wide window."
    >
      <ListRow title="Buttons" subtitle="Button and IconButton" icon="plus" href="/buttons" chevron>
        <Badge label="2" />
      </ListRow>
      <ListRow
        title="Lists and cards"
        subtitle="ListRow, Section, Card, Avatar, Badge, Divider"
        icon="menu"
        href="/lists"
        chevron
      >
        <Badge label="6" />
      </ListRow>
      <ListRow
        title="Inputs"
        subtitle="TextField and TextArea, in a form"
        icon="edit"
        href="/inputs"
        chevron
      >
        <Badge label="2" />
      </ListRow>
      <ListRow
        title="Selection controls"
        subtitle="ToggleRow, Checkbox, RadioGroup, SegmentedControl, Slider"
        icon="check-circle"
        href="/selection"
        chevron
      >
        <Badge label="5" />
      </ListRow>
      <ListRow
        title="Feedback and states"
        subtitle="Spinner, ProgressBar, EmptyState, ErrorState"
        icon="info"
        href="/feedback"
        chevron
      >
        <Badge label="4" />
      </ListRow>
      <ListRow
        title="More parts"
        subtitle="Accordion, Pager, Rating, DataTable, Combobox, ActionSheet and more"
        icon="more"
        href="/more"
        chevron
      >
        <Badge label="12" />
      </ListRow>
    </Section>

    <Section title="Import">
      <ListRow
        title="One import"
        subtitle="Import parts from @duolith/kit: .duo components inside the compiler."
        icon="download"
      />
    </Section>
  </view>
</screen>

<style>
  .page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
</style>
pages/inputs.duo
---
import { derived, state } from "@duolith/client";
import { Badge, Button, Card, TextArea, TextField } from "@duolith/kit";
import Header from "../components/Header.duo";

let name = state("");
let email = state("ada@");
let password = state("");
let search = state("");
let bio = state("Mathematician and writer.");
let sent = state("");

let emailError = derived(() =>
  email.length > 0 && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email) ? "Enter an email such as ada@example.com" : undefined,
);
let isComplete = derived(() => name.trim().length > 0 && !emailError && password.length >= 8);

const send = () => {
  if (isComplete) sent = `Sent for ${name}`;
};
---

<screen title="Inputs" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <Header title="Inputs" subtitle="TextField and TextArea, bound with bind:value." />

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Card title="Sign up" subtitle="a form: Enter in any field sends it">
          <form class="gap-4" on:submit={send}>
            <TextField
              label="Name"
              placeholder="Ada Lovelace"
              hint="As it appears on your profile"
              bind:value={name}
            />
            <TextField
              label="Email"
              type="email"
              icon="mail"
              bind:value={email}
              error={emailError}
            />
            <TextField
              label="Password"
              type="password"
              icon="lock"
              hint="At least 8 characters"
              error={password.length > 0 && password.length < 8 ? "Too short" : undefined}
              bind:value={password}
            />
            <Button label="Create account" submit full disabled={!isComplete} />
          </form>
          <show when={sent}>
            <Badge label={sent} tone="success" icon="check" />
          </show>
        </Card>
      </view>

      <view class="column gap-6">
        <Card title="More fields">
          <TextField
            label="Search"
            type="search"
            icon="search"
            placeholder="Search posts"
            bind:value={search}
          />
          <TextField label="Disabled" value="Cannot change this" disabled />
          <TextArea label="Bio" hint="Shown on your profile" limit={60} bind:value={bio} />
          <TextArea
            label="Notes"
            placeholder="Anything else?"
            rows={3}
            error="Notes are required"
          />
        </Card>

        <Card title="What the page holds" flat>
          <text class="text-caption text-muted">name: {name}</text>
          <text class="text-caption text-muted">email: {email}</text>
          <text class="text-caption text-muted">search: {search}</text>
          <text class="text-caption text-muted">bio: {bio.length} characters</text>
        </Card>
      </view>
    </view>
  </view>
</screen>

<style>
  .page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
  .column {
    flex: 1;
    min-width: 0;
  }
</style>
pages/lists.duo
---
import { state } from "@duolith/client";
import { Avatar, Badge, Card, Divider, ListRow, Section, ToggleRow } from "@duolith/kit";
import Header from "../components/Header.duo";

let opened = state("nothing yet");
let wifi = state(true);
---

<screen title="Lists and cards" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <Header title="Lists and cards" subtitle={`Last pressed: ${opened}.`} />

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Section
          title="Rows"
          action="Edit"
          onAction={() => (opened = "Edit")}
          footer="A row with onPress is a button; with href it is a link."
        >
          <ListRow title="Plain row" />
          <ListRow title="With a subtitle" subtitle="Two lines at most, then an ellipsis" />
          <ListRow
            title="Wi-Fi"
            icon="wifi"
            value="Home"
            chevron
            onPress={() => (opened = "Wi-Fi")}
          />
          <ListRow
            title="Notifications"
            icon="bell"
            chevron
            onPress={() => (opened = "Notifications")}
          >
            <Badge label="3" tone="danger" solid />
          </ListRow>
          <ListRow title="Back to the gallery" icon="home" href="/" chevron />
          <ListRow title="Disabled" icon="lock" disabled onPress={() => (opened = "Disabled")} />
          <ListRow title="Sign out" destructive onPress={() => (opened = "Sign out")} />
        </Section>

        <Section title="Leading and trailing pieces">
          <ListRow title="Ada Lovelace" subtitle="Online now" onPress={() => (opened = "Ada")}>
            <piece name="leading">
              <Avatar name="Ada Lovelace" status="online" />
            </piece>
            <piece name="trailing">
              <Badge label="New" tone="primary" />
            </piece>
          </ListRow>
          <ListRow title="Grace Hopper" subtitle="Away">
            <piece name="leading">
              <Avatar name="Grace Hopper" status="away" />
            </piece>
            <piece name="trailing">
              <text class="text-caption text-muted">2h</text>
            </piece>
          </ListRow>
          <ToggleRow
            label="Wi-Fi"
            hint={wifi ? "Connected" : "Off"}
            icon="wifi"
            bind:checked={wifi}
          />
        </Section>
      </view>

      <view class="column gap-6">
        <Card title="Card" subtitle="title, subtitle and any children">
          <text class="text-body text-muted">Cards group related content on a raised surface.</text>
        </Card>

        <Card
          title="Pressable card"
          subtitle="the whole card is one button"
          onPress={() => (opened = "Card")}
        >
          <piece name="media">
            <view class="media items-center justify-center">
              <icon name="image" class="w-10 h-10" />
            </view>
          </piece>
          <view class="row items-center gap-2">
            <Badge label="Featured" tone="primary" icon="star" />
            <Badge label="Free" tone="success" />
          </view>
        </Card>

        <Card title="Flat card" flat>
          <text class="text-body text-muted">A border instead of a shadow.</text>
        </Card>

        <Card title="Avatar" subtitle="sm, md, lg, xl; initials or photo; presence">
          <view class="row wrap items-end gap-3">
            <Avatar name="Ada Lovelace" size="sm" />
            <Avatar name="Grace Hopper" status="online" />
            <Avatar name="Alan Turing" size="lg" status="away" />
            <Avatar name="Katherine Johnson" size="xl" status="offline" />
          </view>
        </Card>

        <Card title="Badge" subtitle="neutral, primary, success, danger; soft or solid">
          <view class="row wrap gap-2">
            <Badge label="Draft" />
            <Badge label="Beta" tone="primary" />
            <Badge label="Paid" tone="success" icon="check" />
            <Badge label="Overdue" tone="danger" />
          </view>
          <view class="row wrap gap-2">
            <Badge label="12" solid />
            <Badge label="Beta" tone="primary" solid />
            <Badge label="Live" tone="success" solid />
            <Badge label="99+" tone="danger" solid />
          </view>
        </Card>

        <Card title="Divider">
          <text class="text-body text-ink">Above</text>
          <Divider />
          <Divider label="or" />
          <view class="row items-center gap-3 h-6">
            <text class="text-body text-ink">Left</text>
            <Divider vertical />
            <text class="text-body text-ink">Right</text>
          </view>
        </Card>
      </view>
    </view>
  </view>
</screen>

<style>
  .page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
  .column {
    flex: 1;
    min-width: 0;
  }
  .media {
    height: 140px;
    background: var(--color-raised);
    color: var(--color-muted);
  }
</style>
pages/more.duo
---
import { state, toast } from "@duolith/client";
import { Accordion, ActionSheet, Banner, Button, Card, ChipInput, Combobox } from "@duolith/kit";
import { DataTable, Fab, FileInput, Pager, Pagination, ProgressRing, Rating } from "@duolith/kit";
import { DateRangePicker, Drawer, Link, PullToRefresh, SwipeRow, Toast } from "@duolith/kit";
import Header from "../components/Header.duo";

let open = state<string[]>(["shipping"]);
let stars = state(4);
let page = state(3);
let slide = state(0);
let progress = state(0.4);
let sheetOpen = state(false);
let city = state("");
let tags = state(["design", "kit"]);
let sort = state("total");
let descending = state(true);
let files = state<{ name: string; size?: number }[]>([]);
let bannerShown = state(true);
let drawerOpen = state(false);
let rowOpen = state(false);
let refreshes = state(0);
let checkIn = state("");
let checkOut = state("");

const sections = [
  { id: "shipping", title: "Shipping", body: "Orders leave the warehouse within two working days." },
  { id: "returns", title: "Returns", body: "Send anything back within 30 days, for free." },
  { id: "warranty", title: "Warranty", body: "Two years on every part, from the day it arrives." },
];
const cities = ["Amsterdam", "Berlin", "Bristol", "Lisbon", "London", "Madrid", "Paris", "Porto", "Rome"];
const columns = [
  { key: "order", label: "Order", sortable: true },
  { key: "customer", label: "Customer", sortable: true },
  { key: "total", label: "Total", sortable: true, numeric: true },
];
const orders = [
  { order: "A-104", customer: "Ada", total: 42 },
  { order: "A-105", customer: "Linus", total: 18 },
  { order: "A-106", customer: "Grace", total: 77 },
];
const welcome = [
  { title: "Welcome", body: "Every part here works the same on the web, iOS and Android." },
  { title: "Your look", body: "Set look: platform in theme.yaml to look like each platform." },
  { title: "Ready", body: "Swap the theme's tokens, and every part follows." },
];
const actions = [
  { id: "share", label: "Share" },
  { id: "duplicate", label: "Duplicate" },
  { id: "delete", label: "Delete", destructive: true },
];

const rowActions = [
  { id: "archive", label: "Archive" },
  { id: "delete", label: "Delete", destructive: true },
];

/** Stands in for a fetch: a real app loads the feed again here. */
const reload = () =>
  new Promise<void>((done) => setTimeout(() => {
    refreshes = refreshes + 1;
    done();
  }, 600));

/** Stands in for the media-picker effect: a real app asks it for files here. */
const pick = () => (files = [...files, { name: `photo-${files.length + 1}.jpg`, size: 284_000 }]);
---

<screen title="More parts" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <Header
      title="More parts"
      subtitle="Accordion, Banner, Pager, Pagination, Rating, ProgressRing, ActionSheet, Combobox, ChipInput, DataTable, FileInput, Fab, SwipeRow, PullToRefresh, Drawer and DateRangePicker."
    />

    <show when={bannerShown}>
      <Banner
        title="A new version is ready"
        message="Restart to get it."
        action="Restart"
        onAction={() => toast("Restarted")}
        onDismiss={() => (bannerShown = false)}
      />
    </show>

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Card title="Accordion" subtitle="one section open at a time">
          <Accordion sections={sections} bind:open={open} />
        </Card>
        <Card title="Pager" subtitle="previous, next and a dot per page">
          <Pager label="Welcome" pages={welcome} bind:page={slide} />
        </Card>
        <Card title="Pagination" subtitle={`page ${page} of 12`}>
          <Pagination pages={12} bind:page={page} />
        </Card>
        <Card title="Rating and ProgressRing">
          <view class="row items-center gap-6">
            <Rating label="Your rating" bind:value={stars} />
            <ProgressRing value={progress} label="Uploading" />
          </view>
          <Button
            label="Add 10%"
            variant="secondary"
            size="sm"
            onPress={() => (progress = Math.min(1, progress + 0.1))}
          />
        </Card>
      </view>
      <view class="column gap-6">
        <Card title="Combobox and ChipInput">
          <Combobox label="City" options={cities} placeholder="Start typing" bind:value={city} />
          <ChipInput label="Tags" bind:values={tags} />
        </Card>
        <Card title="DataTable" subtitle="press a heading to sort">
          <DataTable
            label="Orders"
            columns={columns}
            rows={orders}
            bind:sort={sort}
            bind:descending={descending}
          />
        </Card>
        <Card title="FileInput and ActionSheet">
          <FileInput label="Add photos" bind:files={files} onPick={pick} />
          <ActionSheet
            title="This photo"
            actions={actions}
            bind:open={sheetOpen}
            onChoose={(id) => toast(`Chose ${id}`)}
          >
            <piece name="trigger">
              <Button label="More actions" variant="secondary" />
            </piece>
          </ActionSheet>
        </Card>
      </view>
    </view>

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Card title="SwipeRow" subtitle="swipe left, or press More">
          <SwipeRow
            label="Lunch with Sam"
            actions={rowActions}
            bind:open={rowOpen}
            onAction={(id) => toast(`Chose ${id}`)}
          >
            <text class="text-body text-ink">Lunch with Sam</text>
            <text class="text-caption text-muted">Tomorrow at noon</text>
          </SwipeRow>
        </Card>
        <Card title="PullToRefresh" subtitle="pull down, or press Refresh">
          <PullToRefresh onRefresh={reload}>
            <text class="text-body text-ink">{`Refreshed ${refreshes} times`}</text>
          </PullToRefresh>
        </Card>
        <Card title="Drawer" subtitle="slides in from the start edge">
          <Drawer title="Sections" bind:open={drawerOpen}>
            <piece name="trigger">
              <Button label="Open the drawer" variant="secondary" />
            </piece>
            <Link href="/">Home</Link>
            <Link href="/lists">Lists</Link>
          </Drawer>
        </Card>
      </view>
      <view class="column gap-6">
        <Card title="DateRangePicker" subtitle="a start, then an end">
          <DateRangePicker label="Stay" bind:start={checkIn} bind:end={checkOut} />
        </Card>
      </view>
    </view>
  </view>
  <Fab label="New order" extended onPress={() => toast("New order")} />
  <Toast />
</screen>

<style>
  .page {
    max-width: 1100px;
  }
  .column {
    flex: 1 1 0;
  }
</style>
pages/selection.duo
---
import { state } from "@duolith/client";
import { Card, Checkbox, RadioGroup, Section, SegmentedControl, Slider, ToggleRow } from "@duolith/kit";
import Header from "../components/Header.duo";

let notifications = state(true);
let digest = state(false);
let terms = state(false);
let updates = state(true);
let plan = state("monthly");
let view = state("list");
let volume = state(40);
let size = state(16);

const plans = [
  { value: "monthly", label: "Monthly", hint: "£4 a month, cancel any time" },
  { value: "yearly", label: "Yearly", hint: "£40 a year, two months free" },
  { value: "lifetime", label: "Lifetime", hint: "£120 once" },
];
const views = [
  { value: "list", label: "List", icon: "menu" },
  { value: "grid", label: "Grid", icon: "image" },
  { value: "map", label: "Map", icon: "location" },
];
---

<screen title="Selection controls" class="bg-canvas">
  <view class="page gap-6 p-4 md:p-8">
    <Header
      title="Selection controls"
      subtitle={`Plan: ${plan}. View: ${view}. Volume: ${volume}.`}
    />

    <view class="gap-6 md:row md:items-start">
      <view class="column gap-6">
        <Section title="ToggleRow">
          <ToggleRow
            label="Notifications"
            hint="Replies and mentions"
            icon="bell"
            bind:checked={notifications}
          />
          <ToggleRow label="Weekly digest" bind:checked={digest} />
          <ToggleRow
            label="Location"
            hint="Turned off by your organisation"
            icon="location"
            disabled
          />
        </Section>

        <Card title="Checkbox" subtitle="pressing the label ticks it too">
          <Checkbox
            label="I accept the terms"
            hint="You can read them any time in Settings"
            bind:checked={terms}
          />
          <Checkbox label="Send me product updates" bind:checked={updates} />
          <Checkbox label="Disabled and ticked" checked disabled />
        </Card>

        <Card title="Slider">
          <Slider label="Volume" unit="%" bind:value={volume} />
          <Slider label="Text size" min={12} max={24} step={2} unit="px" bind:value={size} />
          <Slider label="Disabled" value={30} disabled />
        </Card>
      </view>

      <view class="column gap-6">
        <Card title="RadioGroup" subtitle="role radiogroup; each option is a radio">
          <RadioGroup label="Plan" options={plans} bind:value={plan} />
        </Card>

        <Card title="SegmentedControl">
          <SegmentedControl label="View" options={views} bind:value={view} />
          <SegmentedControl
            label="Range"
            value="week"
            options={[
              { value: "day", label: "Day" },
              { value: "week", label: "Week" },
              { value: "month", label: "Month" },
              { value: "year", label: "Year" },
            ]}
          />
          <SegmentedControl label="Disabled" options={views} value="grid" disabled />
        </Card>
      </view>
    </view>
  </view>
</screen>

<style>
  .page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
  .column {
    flex: 1;
    min-width: 0;
  }
</style>