@pyaella/workshop
v0.2.0
Published
The Workshop design system: Svelte 5 components styled only with Tailwind CSS 4.
Maintainers
Readme
@pyaella/workshop
The Workshop design system as Svelte 5 components, styled only with Tailwind CSS 4.
Self-contained: no runtime dependencies, only the svelte and tailwindcss peers.
What changed in each version: CHANGELOG.md, shipped with the package. Licence: MIT, the artwork included (LICENSE).
Use it in an app
npm install @pyaella/workshopIn the app's Tailwind 4 stylesheet (with @tailwindcss/vite):
@import "tailwindcss";
@import "@pyaella/workshop/theme.css";<script>
import { Button, Link, Prose } from "@pyaella/workshop";
</script>
<Button onclick={validate} {pending}>Validate contract</Button>
<Link href="/docs">Read the manual</Link>
<Prose as="article">{@html body}</Prose>theme.css brings three things:
- The tokens, as Tailwind theme variables, so
bg-canvas,text-ink,border-line,rounded-card,shadow-paper,max-w-reading,font-displayandtext-display-1are ordinary utilities in the app. - A small base layer: body colours and font, focus ring, selection and reduced motion.
- The component recipes, in sublayers of
@layer components.
It also tells the app's build to scan this package for class names (@source), because Tailwind skips node_modules by default. An app that uses part of the catalog can import less: see Stylesheets.
Fonts
The package names its faces (Inter, Fraunces and IBM Plex Mono) but ships no font file and depends on no font package. Without them, a reader gets the face if their machine has it, or the system fallback. To load them, install the Fontsource packages and import them once, in the app's root layout:
npm install @fontsource-variable/inter @fontsource-variable/fraunces @fontsource/ibm-plex-monoimport "@fontsource-variable/inter";
import "@fontsource-variable/fraunces/opsz.css";
import "@fontsource/ibm-plex-mono/400.css";
import "@fontsource/ibm-plex-mono/500.css";The variable packages register "Inter Variable" and "Fraunces Variable", which the stacks name first.
Stylesheets: the whole catalog, or what you use
theme.css is the whole catalog. An app that uses part of it can import css/core.css and then one entry per group it uses, and pays only for those:
@import "tailwindcss";
@import "@pyaella/workshop/css/core.css";
@import "@pyaella/workshop/css/forms.css";
@import "@pyaella/workshop/css/anchored.css";
@import "@pyaella/workshop/css/selection.css";core.cssholds the tokens, the base layer and thedarkvariant. Every entry declares the order the groups cascade in, so the entries may come in any order.- An entry that needs another fails the build without it, by name: leave out
anchored.cssbesidemenus.cssand the app's build stops with "Cannot apply unknown utility classwk-entry-anchored". Add the entry it names. Nothing can check that you imported the entry of a component you render: without it, the component draws unstyled, so use the table below. - Import each entry once. Tailwind does not deduplicate a stylesheet imported twice, so the entries never import each other.
- Each entry scans only its own components for class names (
@source). CommandDialogis aDialog: it also needscss/overlays.css, which no marker can require of one component.- Every recipe sits in a sublayer of
@layer components(components.core,components.forms, ...). A utility you pass still wins over it. A rule you write in your own@layer componentswins over every recipe whatever its specificity (it sits after the sublayers), where before the split it competed on specificity.
| Entry | What | Components | Needs (besides core) |
|---|---|---|---|
| css/core.css | tokens, the base layer, the dark variant, and the content components | Alert, AspectRatio, Avatar, Badge, Breadcrumb, Button, ButtonGroup, Card, Empty, Eyebrow, Heading, Icon, Item, Kbd, Lede, Link, Pagination, Progress, Prose, Separator, Skeleton, Spinner, Status, Table, Text | — |
| css/forms.css | form controls | Checkbox, Field, Input, InputGroup, Label, NativeSelect, RadioGroup, Slider, Switch, Textarea, Toggle | — |
| css/site.css | site patterns | CtaBand, FeatureGrid, Hero, Section, SiteFooter, SiteHeader, SkipLink, ThemeScript, ThemeToggle, Wordmark | — |
| css/journal.css | journal patterns | ArticleLayout, Byline, CodeBlock, Figure, FootnoteRef, Footnotes, PostCard, PostList, TableOfContents, TagList | — |
| css/overlays.css | modal overlays | AlertDialog, Dialog, Drawer, Sheet | — |
| css/anchored.css | anchored overlays and toasts | HoverCard, Popover, Toaster, Tooltip | — |
| css/disclosure.css | disclosure and navigation | Accordion, AccordionItem, Collapsible, NavigationMenu, ScrollArea, Sidebar, Tabs | anchored.css |
| css/menus.css | menus and command | Command, CommandDialog, ContextMenu, DropdownMenu, Menubar | anchored.css |
| css/selection.css | selection | Combobox, InputOTP, Select, ToggleGroup | forms.css, anchored.css |
| css/dates.css | dates | Calendar, DatePicker, RangeCalendar | forms.css |
| css/data-table.css | the data table | DataTable | forms.css |
| css/workspace.css | workspace | Carousel, Chart, Resizable | — |
| css/agent.css | the transcript | Attachment, Bubble, Marker, Message, Trace | — |
| css/converse.css | the behaviours | MessageScroller, Questionnaire | agent.css, forms.css |
Components
| Group | Components |
|---|---|
| Actions and links | Button, ButtonGroup, Link |
| Typography | Heading, Text, Eyebrow, Lede, Prose |
| Metadata | Badge, Status, Kbd, Avatar, Icon plus icon* data (iconCheck, iconAlert, ...) |
| Surfaces | Card, Item, Separator, AspectRatio |
| Data and navigation | Table, Breadcrumb |
| Feedback | Alert, Empty, Progress, Spinner, Skeleton |
| Forms | Field, Label, Input, Textarea, InputGroup, NativeSelect, Slider, Checkbox, RadioGroup, Switch, Toggle |
| Site | SiteHeader, SiteFooter, SkipLink, Wordmark, Hero, Section, FeatureGrid, CtaBand, ThemeToggle, ThemeScript |
| Artwork | Artwork, ArchitectureCard, and 29 illustrations from @pyaella/workshop/art/<family>-<id> |
| Overlays | Dialog, AlertDialog, Sheet, Drawer |
| Anchored overlays | Popover, Tooltip, HoverCard, Toaster and toast() |
| Disclosure and navigation | Collapsible, Accordion, AccordionItem, Tabs, NavigationMenu, Sidebar, ScrollArea |
| Menus and command | DropdownMenu, ContextMenu, Menubar, Command, CommandDialog |
| Selection | Select, Combobox, ToggleGroup, InputOTP |
| Dates | Calendar, RangeCalendar, DatePicker |
| Data | DataTable |
| Workspace | Chart, Carousel, Resizable |
| Agent and collaboration | Message, Bubble, Marker, Attachment, Trace, MessageScroller, Questionnaire |
| Journal | ArticleLayout, PostCard, PostList, TableOfContents, Byline, TagList, Pagination, Figure, FootnoteRef, Footnotes, CodeBlock, and readingMinutes() |
Every one is a named export of @pyaella/workshop; the gallery (npm run dev) shows each variant in both themes.
Themes
With no attribute, a page follows the reader's system preference, and no script is needed for that. To pin a theme, set data-theme="day" or data-theme="night" on <html>, or on any element to pin just that subtree. A night band inside a day page is just an attribute: an element with data-theme="day" or "night" paints its own theme's canvas and ink (your classes on it win; inside a Card or a panel, that means a canvas patch, so add bg-transparent if you want the surface to show). The tokens are exact at any depth of nesting. The dark: variant follows the nearest data-theme too, exact to three levels counting a pinned root (a night page, a day panel, a night card inside it), because selectors cannot express "nearest ancestor" at any depth.
To let readers pin a theme, put <ThemeScript /> in the root layout (it applies a stored
pin before first paint) and a <ThemeToggle /> in the header. followSystem() drops the pin.
Under SvelteKit's CSP:
// vite.config.js, hash mode
import { THEME_SCRIPT_HASH } from "@pyaella/workshop/theme";
sveltekit({ csp: { mode: "hash", directives: { "script-src": ["self", THEME_SCRIPT_HASH] } } });Styles: the package works under a strict style-src 'self', with no 'unsafe-inline'. No
component writes a style attribute. A value from your data reaches the page in one of three ways:
- a preset in the stylesheet:
Progress's fill (one per whole percent),Resizable's size; - an attribute that is not a style:
AspectRatio's ratio is an SVGviewBox; - the CSSOM once the page is live, which the policy allows:
Avatar's photo, so until then (and with no JavaScript) an Avatar is its initials.
A style attribute you pass yourself is yours, so prefer a class (class="[--wk-anchored-max:16rem]"). Two
lines of SvelteKit's own carry inline styles that such a policy refuses:
app.html's<div style="display: contents">: write<div class="contents">.- The route announcer,
#svelte-announcer: restate its style in your CSS, or after a client-side navigation it shows the page's title:
#svelte-announcer {
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}The browser still reports the announcer's refused attribute; that report is SvelteKit's, not the package's.
In nonce mode SvelteKit gives components no nonce: put the script in app.html instead,
<script nonce="%sveltekit.nonce%">…</script>, with the text of themeScript(THEME_KEY).
If the script cannot run at all, the toggle still applies a stored pin once hydrated. The
exported hash covers the default storage key; with your own storageKey, hash
themeScript(storageKey) yourself. Use one storage key per page.
Changing how it looks
The options run from smallest to largest change:
Pass classes. Every component except
ThemeScript(which renders only into<head>) takesclass, and the classes you pass always win over the recipe. The recipe sits in@layer componentsand your utilities sit in@layer utilities, so the override does not depend on class order and needs no merging library. A class reaches the element it lands on, not that element's children: a Card's, Section's or CtaBand's padding sits on its inner sections, so use<Card padding="none">or override the custom property (class="[--wk-card-pad:0.5rem]").<Button class="w-full px-10">Continue</Button>Pass attributes. Every other attribute goes to the root element:
aria-*,data-*,id,roleand event handlers. The exceptions go to the element assistive technology reads:- the form controls with a wrapper (
Checkbox,Switch,Slider,NativeSelect,Select,Combobox,InputOTP, andProgress):classstyles the wrapper, and every other attribute,refincluded, goes to the control itself (the<input>,<select>, or the progressbar); Resizable:aria-labelandaria-labelledbyto the separator (the wrapper is a generic box);Dialog,AlertDialog,SheetandDrawer: to the<dialog>(the root is a host with no box);Popover,TooltipandHoverCard: to the popover;DropdownMenu: to the menu;ContextMenu:idto the menu, the rest to the area;CommandDialog:idto the<dialog>, the rest to theCommandinside it;Tabs:aria-labelandaria-labelledbyto the tablist.
A component overrides one of your attributes only where its own state requires it (a disabled link's
role, a pending button'saria-busy, an urgent Alert'srole="alert", a night Section'sdata-theme, an Icon'sroleandaria-hidden, which follow itslabel). Otherwise yours wins:role,tabindex,aria-label(over alabelprop and its default, such as a Toaster's "Notifications"),aria-labelledby(and anaria-labelreplaces the component's own label reference),aria-invalid(true,grammar,spelling),aria-valuetextanddata-theme. Winning means you own the contract: aTablegivenrole="presentation"is still a tab stop with a label (give ittabindex={-1}too), and aSpinnergivenrole="none"is no longer announced. Event handlers are wrapped, never replaced: where a component has a handler of its own (a Toggle'sonclick, a Slider'soninput, an AccordionItem'sontoggle, a menu'sonkeydown), its runs first and then yours, so yours sees the new state. A unit test checks every component for this. A value typed in a Slider'sexactbox arrives throughbind:value, notoninput. The variant attributes (data-variant,data-size,data-tone,data-layout, …) are always set from the props.bind:refgives the element onButton,Link,Input,Textarea,Checkbox,Switch,NativeSelect,Select,Combobox,InputOTP,DatePicker,SliderandToggle; for anything else, usebind:thison a wrapper or anid.- the form controls with a wrapper (
Rebrand with tokens. Each colour role (
engine,canvas,ink, …) and shadow reads a day/night pair. Override the pair once on:root, after the import, and every theme state follows: pinned, system, and islands.:root { --wk-day-engine: #2f5d50; --wk-night-engine: #9fd3c1; }Shadows work the same way per colour stop (
--wk-day-shadow-paper-1,-2, …); their geometry is fixed, soshadow-paper shadow-ink/20andshadow-paper/50still work.Do not override
--color-engineitself; the theme blocks would undo it in some states. Tokens that do not change with the theme (fonts, radii, measures, thepigment-*colours) are ordinary Tailwind theme variables, so an@theme { … }block overrides them. Pigments are prefixedpigment-, so Tailwind's own palette (blue-500,amber-300, …) keeps its meaning.Style the hooks. Variants are data attributes (
data-variant,data-size), so Tailwind'sdata-[variant=ghost]:works from outside the component.Read the tokens from code. Python or JavaScript can read
@pyaella/workshop/tokens.json, the same file the CSS is generated from.
Forms
Wrap a control in a Field and it is wired for you: the label's for, the control's id,
aria-describedby (description, then error), aria-invalid, required and disabled.
The error is spoken as an error and appears in a polite live region. value, checked,
indeterminate and pressed are bindable.
<Field label="Service name" description="Lower case." error={nameError} required>
<Input bind:value={name} />
</Field>Set a control's id as <Field id="...">, or on the control itself (the label follows it
once the page is interactive; on a page with no JavaScript, use the Field's). Checkbox and
Switch take their name as label="…" or as children, and RadioGroup as legend; they are not wrapped in a
Field; their descriptions sit outside the <label>, so they describe the control rather
than become part of its name. Give a RadioGroup a name inside a <form>. A
NativeSelect with no value and no placeholder takes its first enabled option, as a native
select does.
A form reset returns every control to the value the page was drawn with (or mounted with, for
a form the page adds later), as it does with no JavaScript, and its bound value follows: text,
checks, choices, selects, sliders, codes, dates and the calendars alike. A value the reader
chose before the page was live is kept, and a reset still returns to the drawn one. (Svelte removes the server's value and checked attributes at hydration,
so each control sets that default again.)
The same idea has the same name across the controls, and each also takes its sibling's:
Select and Combobox take options as well as items, NativeSelect and RadioGroup
take items as well as options, ToggleGroup takes legend as well as label, and both
groups take labelHidden.
SiteHeader takes homeHref (a base path) for the home link and the Wordmark, actions
that always stay in the bar, and menuActions that move into the menu on narrow screens
(rendered twice, one copy hidden: links and buttons only, no ids or stateful content).
Artwork
Twenty-nine Workshop illustrations: 5 heroes, 11 architecture cards and 13 line drawings, generated for Pyaella, with commercial use approved by the owner. Import each from its own module, so the build carries only the images a page uses:
<script>
import { Artwork, ArchitectureCard } from "@pyaella/workshop";
import { artHeroWorkshop } from "@pyaella/workshop/art/heroes-workshop";
import { artCardDatabase } from "@pyaella/workshop/art/cards-database";
</script>
<Artwork art={artHeroWorkshop} priority />
<ArchitectureCard art={artCardDatabase} href="/architecture/database" />@pyaella/workshop/art exports all 29 at once (for a gallery), and then every image is in
the build: a bundler emits an imported image before it tree-shakes. The metadata alone
(titles, alt text, sizes, no images) is @pyaella/workshop/art/catalog.json. Art keeps its
printed colours in the evening theme and in forced colours, each family on its own paper mat.
The art needs a bundler that imports images (Vite does). The 13 line drawings are small
enough that it inlines them as data: URIs, so a Content-Security-Policy needs
img-src 'self' data:. Each image ships at one size; responsive variants are planned.
Journal
An article page:
<ArticleLayout title={post.title} lede={post.summary} headings={post.headings} spy>
{#snippet byline()}<Byline authors={post.authors} date={post.date} readingTime={readingMinutes(post.html)} />{/snippet}
{@html post.html}
{#snippet footer()}<TagList tags={post.tags} /><Footnotes notes={post.notes} />{/snippet}
</ArticleLayout>- The body is Prose. Rendered Markdown is styled as it is, GFM footnotes included. Inside
it,
<Figure width="wide">(or classwk-wideon any element, for Markdown) breaks out past the reading measure, andwidth="full"(wk-full) spans the article's column. - The table of contents comes from
headings({ id, text, level }, as a Markdown pipeline reports them; the headings in the body need those ids). It lists the two levels under the title (h2 and h3 for an h1 title). On wide screens it is a sticky column beside the body; on narrow ones a native "On this page" disclosure, so it works with no JavaScript.spymarks the section being read once the page is interactive. - Dates (
Byline,PostCard) are<time datetime>elements printed inlocale(defaulten-US) and in UTC, so the server and every browser print the same day. Pass ISO 8601: a date-only string ("2026-11-21") is that calendar day, and a timestamp with no zone is read as UTC. Anything else ("November 21, 2026") is not a date and is left out. CodeBlockshowscodeas text, or the markup of your highlighter (Shiki, Prism) passed ashtml; it ships no highlighter. Copy copiescode. The copy button appears once the page is interactive, so a page with no JavaScript shows no dead button.Paginationis links:hrefbuilds each URL, either a function of the page number or a template string ("/journal/page/{page}", the form data and codegen can carry). Previous and next carryrel, and the bar keeps a constant width as the reader pages through.- Footnotes:
<FootnoteRef id="x" n={1} />in the text and<Footnotes notes={[{ id: "x", text: "…" }]} />at the end. With two articles on one page, give each aprefix. A second reference to one note takesoccurrence={2}, whose id isfnref-<id>-2as in GFM, so do not give a note an id that ends in-<number>. PostCardis one link (the title, stretched over the card). Its authors and tags are text, so nothing clickable sits inside the link area.
Overlays
Dialog, AlertDialog, Sheet and Drawer are the browser's own <dialog>, opened by an
invoker button, so they work with no JavaScript: they open as a modal, move focus in,
keep Tab inside, close on Escape, sit above everything and return focus to the trigger.
<Dialog title="Rename service" description="Names are lower case.">
{#snippet trigger(attrs)}<Button {...attrs}>Rename</Button>{/snippet}
<Field label="Service name"><Input bind:value={name} /></Field>
{#snippet footer(close)}
<Button variant="secondary" {...close}>Cancel</Button>
<Button {...close} onclick={save}>Save</Button>
{/snippet}
</Dialog>- Opening and closing. The
triggersnippet receivescommandfor,command="show-modal"andaria-haspopup, to spread onto a button; any button with the same attributes, anywhere on the page, opens it (give the dialog anid). Thefootersnippet receives the close attributes. A Dialog, Sheet or Drawer also closes on a click on the backdrop (dismissible={false}turns that off for unsaved work) and with its corner button (closeButton,closeLabel). - Naming. A
titleis shown and names it; without one,label(or anaria-label) names it unseen. AlertDialogasks for a decision: no backdrop dismissal and no corner button. The first button given the footer's close attributes takes the focus on opening (they carryautofocus), even when the body has a link, so put the safe choice first. Escape cancels.openis bindable once the page is interactive, and follows the dialog however it closed.oncloseand the other dialog events reach the<dialog>. A page rendered on the server starts with it closed.- Focus returns to what opened it. Opened from inside a popover or menu (which opening a modal closes), it returns to the button that opens that popover. A closed modal stays hidden whatever
displayyourclasssets. - Layers. Escape closes one layer at a time, a tooltip or hover card included. A click on the backdrop is outside every layer, so it closes a popover open in the dialog and the dialog together (the platform's light dismiss); use
dismissible={false}where that would lose work. Sheetdocks to an edge (side:right,left,top,bottom, orstartandend, which follow the writing direction: usestartfor a navigation Sheet, so it opens from the Sidebar's edge on a right-to-left page);Drawerrises from the bottom, with a handle that is decoration (it does not drag).- Browsers. Invoker commands need Chrome 135, Firefox 144 or Safari 26.2. On older browsers the dialogs open once the page is interactive (a small listener stands in), but not on a page with no JavaScript.
- The scroll lock is CSS only: while a modal is open, the page does not scroll, and a modal opened from a scrolled page stays in view without moving it. With classic (non-overlay) scrollbars, as on Windows, the page shifts by the scrollbar's width while it is open.
- Where a dialog lives. Keep a Dialog out of anything hidden, such as
SiteHeader'smenuActions(rendered twice, one copy hidden) or a closed disclosure: a modal opened insidedisplay: noneis invisible but still makes the page inert. Render the Dialog elsewhere and put only a trigger button, with its attributes, in the menu. - Forms.
<form method="dialog">inside the body closes the dialog with the submitter's value. The footer sits outside the body, so a submit button there needs the form's id (<Button type="submit" form="rename-form">). - A long body scrolls inside the dialog, so the title, the footer and the close button stay in view; it becomes a tab stop while it overflows, so a keyboard can scroll it.
- A dialog the reader opens before the page has hydrated stays open when it does.
Popovers, tooltips and toasts
Popover, Tooltip and HoverCard are the browser's own popover, placed next to their
trigger by CSS anchor positioning: no anchor names, no inline styles, and they stay on screen:
they flip to the other side when there is no room on theirs, and an overlay too wide for its
align near an edge is centred on its trigger and slid in.
<Popover title="Health filter">
{#snippet trigger(attrs)}<Button variant="secondary" {...attrs}>Filter</Button>{/snippet}
<Checkbox label="Healthy" />
{#snippet footer(close)}<Button size="sm" {...close}>Close</Button>{/snippet}
</Popover>
<Tooltip content="Checks the contract without compiling.">
{#snippet trigger(attrs)}<Button aria-label="Validation information" {...attrs}>?</Button>{/snippet}
</Tooltip>Popoveropens with no JavaScript: thetriggersnippet receivespopovertarget(not a Dialog'scommandfor:popovertargetneeds no JavaScript in many more browsers), and thefootersnippet the attributes that hide it. A click outside or Escape closes it, focus returns to the trigger, and Tab from the trigger moves into it. Atitle(shown), alabelor anaria-labelmakes it a named, non-modal dialog.side(top,right,bottom,left) andalign(start,center,end) place it;startfollows the writing direction.openis bindable.- A
classyou pass never shows a closed popover, even one that setsdisplay. Tooltipis the trigger's accessible description (aria-describedby, given to thetriggersnippet), never its name: an icon-only button still needs its ownaria-label. Its text iscontent(textworks too). It shows on hover afterdelay(400 ms) and at once on keyboard focus, the pointer can move onto it, and Escape hides it (only it: a Dialog it sits in stays open). Text only.HoverCardpreviews what a link leads to, on hover (openDelay, ordelayas Tooltip calls it;closeDelay) and keyboard focus; Tab from the trigger moves into it. Its content also describes the trigger. Keep it supplementary: the link must work without it. Inside running text give it phrasing content (text,<strong>,<a>,<span>): a<div>or<p>would end the paragraph.- Hover takes JavaScript. Tooltips and hover cards show only once the page is interactive (the descriptions are there without it). Touch is ignored: a tap is a click.
- Placement needs CSS anchor positioning (tested in Chrome 156, Firefox 157 and Safari 27.2). Elsewhere, or when a bound popover is opened with no trigger, it opens centred on the screen. Alignment follows the page's direction, so a right-to-left page (
dir="rtl"on<html>) is right in every engine; a right-to-left part of a left-to-right page aligns as left-to-right. Firefox places an overlay as if atransformon its trigger's ancestors were not there (a trigger inside a translated or centred-by-transform box gets its overlay off by the shift): position such a box with layout (flex, grid, margins) instead. - Taller than the room. An overlay that fits on neither side of its trigger at its natural size is capped to the larger side (or, beside its trigger, to the whole column), centred on the trigger, and scrolls; it never runs off the screen. An overlay placed beside its trigger (a submenu,
side="right"or"left") that is too wide for either side, as on a phone, opens over the trigger instead. A menu (24rem) and a Combobox's list (20rem) keep their own caps. Set yours with--wk-anchored-max, from a utility such asclass="[--wk-anchored-max:16rem]"(which a strictstyle-srcallows) or your own CSS, on a Popover, Tooltip, HoverCard or DropdownMenu; a Combobox's, ContextMenu's and Menubar'sclassgoes on their wrapper, so set it in your CSS on.wk-combobox__listor.wk-menuinstead; amax-heightof your own is overridden while the platform places the overlay. Once live, an overlay that had to be capped is held where it fits, and placed afresh when its size changes (content shown after it opened, a trigger the page moved). Once the page is live, a tall Popover with nothing to focus in it makes its body a tab stop, so the keyboard can scroll it. toast(message, options)raises a toast;toast.dismiss(id)removes one (an id given as a number finds the toast raised with it) andtoast.dismiss()all. Options:description,tone(neutral,success,warning,danger),durationin ms (6000;Infinitystays),action({ label, onclick }, which also dismisses it; a toast with an action stays until dismissed unless you give it aduration, so a keyboard can reach it), andid: raising a toast with an id already shown replaces it instead of stacking a duplicate. Place one<Toaster />per page (position,limit,label,dismissLabel,severityLabels); if there are two, the first to mount shows the toasts and the other stays empty.- Toasts are announced politely, each has a dismiss button (dismissing from the keyboard moves focus to the next toast, or back where it came from), and their timers pause while the pointer or focus is on them, while the tab is hidden and while a modal is open. Everything outside an open modal is inert, toasts included, so raise feedback inside a dialog with an
Alert, and put errors that must persist in the page, not only in a toast. toast()does nothing on the server, so a toast raised while rendering one request never reaches another: raise toasts from event handlers and effects.
Disclosure and navigation
<Accordion bind:value>
<AccordionItem value="requirements" summary="Contract requirements">…</AccordionItem>
<AccordionItem value="governance" summary="Governance policies">…</AccordionItem>
</Accordion>
<Tabs label="Inspector views" items={[{ value: "schema", label: "Schema" }, { value: "policy", label: "Policy" }]} bind:value={tab}>
{#snippet panel(item)}<SchemaView kind={item.value} />{/snippet}
</Tabs>CollapsibleandAccordionItemare native<details>, labelled bysummary(titleworks too, as on every other titled component): they open from a click or the keyboard with no JavaScript, closed content is not a tab stop, and one the reader opens before the page hydrates stays open. An item nested in another item's body is a disclosure of its own, not part of the outer Accordion.Accordiondefaults totype="single", which gives its items one sharedname, so the browser keeps one open (tested in Chrome 156, Firefox 157 and Safari 27.2);"multiple"lets each open on its own. An item'svaluemust be unique within its Accordion: a later item with a value already taken opens and closes on its own, as one with no value does.valueis bindable (the open value, or a list for"multiple"). The height eases open in Chromium; elsewhere it opens at once. The summary is a button to assistive technology, so a heading inside it is not announced as one.Tabsfollows the tabs pattern: one tab stop, arrow keys (Up and Down whenorientation="vertical"), Home and End, disabled tabs skipped,activation="automatic"or"manual". Name it withlabel,aria-labeloraria-labelledby(each goes to the tablist). Thepanelsnippet is given your item as you passed it, extra fields included. Values must be unique (a repeated value's tab is disabled), and a boundvaluefollows the tab shown, so an unknown or removed value becomes the first enabled tab's. Every panel is in the page: inactive ones arehidden="until-found", so find-in-page reveals them and selects their tab (a disabled tab's panel is plainly hidden), andaria-hidden, so assistive technology meets only the selected one. Switching tabs takes JavaScript: on a page rendered withcsr = falseuse an Accordion (find-in-page can still reveal a panel there, but it stays hidden from assistive technology).NavigationMenuis links, never menu roles. A top-level item is a link, a plain label (nohref), or a section ({ label, items }) whose button opens a popover of links, each with an optionaldescription(a link with nohrefis left out), anchored under it (with no JavaScript, asPopoverdoes).currentPathmarks the current link and its section. The list wraps on narrow screens; for a site menu that collapses, useSiteHeader.Sidebartakessectionsof{ title?, items }, where each item is a{ label, href, icon?, badge? }link (iconis one path or a list, asIcontakes; an item with nohref, and a section left with none, are left out), and marks the current one bycurrentPath. Once the page is interactive a button collapses it to a rail (collapsedis bindable;persist="<key>"remembers it in this browser, read after the page loads, so passcollapsedfrom a cookie if the first paint must match). A collapsed link keeps its label as its name and shows it beside the rail on hover and keyboard focus (Escape hides it). The collapse button comes first, as it is drawn at the top. Two Sidebars sharing apersistkey do not follow each other. On narrow screens, put the same Sidebar in aSheet(side="start"). Theheaderandfootersnippets are given{ collapsed }, so what they hold can fit the 4rem rail.ScrollAreais a named region and a tab stop (alabeloraria-labelis required: without a name it is neither), with a thin scrollbar; give it a height withclass(max-h-72). Scrolling past its end scrolls the page.
Menus and command
<DropdownMenu
items={[
{ label: "Duplicate", shortcut: ["mod", "D"], onselect: duplicate },
{ label: "Share", items: [{ label: "Copy link" }, { label: "Email" }] },
{ type: "separator" },
{ type: "checkbox", label: "Show hidden", checked: hidden, onselect: (d) => (hidden = d.checked) },
{ type: "radio", label: "Sort by", value: sort, onselect: (d) => (sort = d.value), items: [{ label: "Name", value: "name" }, { label: "Date", value: "date" }] },
{ label: "Delete", tone: "danger", onselect: remove },
]}
>
{#snippet trigger(attrs)}<Button variant="secondary" {...attrs}>Actions</Button>{/snippet}
</DropdownMenu>
<CommandDialog hotkey={["mod", "k"]} groups={[{ heading: "Contract", items: [{ label: "Compile contract", onselect: compile }] }]} />- Items (
DropdownMenu,ContextMenu,Menubar) are data: an action (label, optionalvalue,icon,shortcut,tone: "danger"), a link (href), acheckbox(checked), aradiogroup (valueand its options initems), agroup(a heading over itsitems), aseparator, or a submenu (an item withitems). Choosing one calls the item's ownonselect, then the menu's, with{ item, value, checked?, group? }. A checkbox or radio option leaves the menu open and reports its new state: update your data to show it. An action or a link closes the menu and puts focus back where it was. - The keys are the menu pattern's once the page is interactive: Enter, Space or Down on the button opens a menu on its first item, Up on its last; arrows move and wrap, Home and End, typing the start of a label jumps to it (spaces included: "show h"), Right and Left open and close a submenu (mirrored on a right-to-left page), Escape closes one level, and Tab closes the menu and moves on. A disabled item is focusable, so the reader learns it exists, and does nothing. A
shortcutis shown and given to assistive technology asaria-keyshortcuts, but the menu does not bind it: bind it yourself, and show only shortcuts that work. - A menu is named by its button, or by
label(or anaria-label) when that is not enough. - Before hydration, and on a page rendered with
csr = false, aDropdownMenu's button still opens its popover and the items are ordinary buttons and links in Tab order: links work, actions wait for JavaScript. Nothing promises a menu until then (noaria-haspopup, no menu roles), and a checkbox's or radio's state is shown but reaches assistive technology only once live (aria-checked). ContextMenuwraps an area; a right-click opens the menu at the pointer, and the Menu key or Shift+F10 opens it beside the focused element. Shift with a right-click still gives the browser's own menu. It needs JavaScript and nothing reveals it on a touch screen or to a keyboard user who does not know to ask, so always offer the same actions somewhere visible, such as a "More actions"DropdownMenuwith the sameitems. Give it alabel: it has no button to name it. Itsidis the menu's (as a DropdownMenu's is);classand every other attribute go on the area. Inside a transformed element (an openDialog,SheetorDrawerincluded) it still opens at the pointer.Menubartakesmenusof{ label, items }(a menu with no items is left out). It is one tab stop: Left and Right move along the bar (from inside an open menu, to the next menu, open), Down opens a menu, and with one open, hovering another opens it. It is for an application's commands; for a site's destinations useNavigationMenu.Commandis a search overitemsandgroupsof{ heading?, items }, each{ label, value?, keywords?, shortcut?, icon?, disabled?, href?, onselect? }. Focus stays in the search: Up and Down move the highlighted command, Enter runs it, Escape clears the search. It matches every typed word, ignoring case and accents, against the label andkeywords, and keeps your order (passfilterto match differently). The first match is highlighted, so Enter runs what is shown, and nothing when nothing matches.queryis bindable, and the number of matches is announced. Before hydration the search is disabled (its links still work).CommandDialogputs aCommandin a modalDialog: it opens from itstrigger,open, orhotkeyanywhere on the page (spelled asKbdspells keys:["mod", "k"]is Command-K on Apple platforms and Control-K elsewhere,["shift", "esc"],["ctrl", "space"]; exactly those modifiers, and a held key does not toggle it again), on an empty, focused search; running a command closes it and focus returns. Name it withtitle(shown) orlabel.
Selection
Each is a native control first. It works with no JavaScript, submits with its form under name, and the browser's own keyboard and assistive-technology behaviour comes with it; the page adds the rest once interactive. Select, Combobox and InputOTP take Field wiring as Input does. ToggleGroup carries its own legend, as RadioGroup does, and a ToggleGroup with no items is left out.
<Field label="Region">
<Select name="region" bind:value={region} items={[{ value: "eu", label: "Europe", description: "Frankfurt and Dublin" }, { value: "us", label: "United States" }]} />
</Field>
<Field label="City"><Combobox name="city" bind:value={city} items={cities} /></Field>
<ToggleGroup label="Alignment" name="align" bind:value={align} items={[{ value: "left", label: "Left" }, { value: "center", label: "Center" }]} />
<Field label="Verification code"><InputOTP name="code" groups={[3, 3]} oncomplete={verify} /></Field>Selectis the platform's<select>.itemsare{ value, label, description?, icon?, disabled? }, andgroupsare{ label, items }(labelled, afteritems; an empty group is left out). Where the browser can style a select (appearance: base-select: Chrome and Safari today), the picker is the Workshop's: each item's icon and description, a tick on the chosen one, and the chosen item (icon, no description) in the closed control. Elsewhere (Firefox), the browser's own picker shows each item as text ("Europe — Frankfurt and Dublin"), and the closed control looks the same. Aplaceholderis a disabled first item, chosen while the value is empty; with no placeholder, an empty value takes the first enabled item (asNativeSelect), so the select is never blank. A value the list cannot show is kept, not replaced. For the operating system's picker everywhere (the wheel on a phone), useNativeSelect.Comboboxis a text field that suggests: the text is the value, so free text is a fine answer.itemsare{ value, label?, description?, keywords?, disabled? }, wherevalueis the text it fills in. Before the page is interactive it is an<input list>with a<datalist>(the browser suggests). Once live it is the combobox pattern: typing filters (every word, ignoring case and accents, asCommandmatches; passfilterto match differently), Down opens the list and moves (Alt+Down only opens it), Enter fills in the highlighted suggestion, Escape closes the list and then clears the text. Nothing is highlighted until the reader moves, so Enter submits what was typed. While an input method is composing, its keys are its own.onselectgets{ item, value }, andemptyis shown when nothing matches (by default the list just closes). For a choice that must be one of the list, useSelect.itemsmay be your own type (ComboboxItemplus fields of your own), andonselecthands your item back typed. On a right-to-left part of a left-to-right page, Firefox places the list off the field (it is correct when the whole page is right to left).ToggleGroupis joined toggles:type="single"(native radios, so the arrow keys move the choice, and once chosen one always is) or"multiple"(native checkboxes).valueis a string or a list.requiredapplies tosingle(a set of checkboxes has no native "at least one"). Name the group withlabel(hidden unlesslabelVisible); an item withiconOnlyshows only its icon and keeps its label as its name. Safari shows no focus ring after the arrow keys move a radio's focus (WK-G24); the focused toggle is then the chosen one, drawn as chosen.InputOTPis a one-time code (its boxes shrink to fit a narrow column): one input (autocomplete="one-time-code"), so pasting a whole code, the phone's SMS autofill and form submission are the browser's own.lengthis 4 to 8 (6),groupssplits the boxes ([3, 3]),modeis"numeric"(the default) or"alphanumeric". Full-width and Arabic-Indic digits count as digits; anything else typed or pasted is dropped, after the paste is read whole ("123-456" keeps every digit), and a pasted whole code replaces what was there. Before the page is interactive it is a plain code field; once live, boxes are drawn over it in exactly its place (nothing moves), with the next box to fill marked. Typing goes on the end; select all, then type or paste, replaces the code.oncompleteruns once each time the reader completes a code, including one completed before the page was interactive (not for a value the app sets). A code reads left to right on every page.- Chosen before hydration: a value the reader chose or typed before the page was interactive is kept, not reset by hydration.
Dates
A date is an ISO day string ("2026-11-24") and a month is "2026-11", never a Date: a Date is an instant, and the day it falls on depends on the time zone reading it. An impossible or malformed value, min or max is ignored, never shown. The calendars are Gregorian in every locale (a locale whose own calendar is another, such as fa-IR, keeps its language and digits).
<Calendar name="due" bind:value={due} min="2026-11-01" unavailable={(d) => holidays.has(d)} />
<RangeCalendar startName="from" endName="to" bind:value={audit} onvaluechange={load} label="Audit window" />
<Field label="Release date"><DatePicker name="release" bind:value={release} min="2026-11-01" /></Field>Calendaris the date grid: one tab stop, on the chosen day. The arrow keys move a day or a week (Left and Right swap on a right-to-left page), Home and End go to the week's ends, Page Up and Page Down a month, and with Shift a year; Enter, Space or a click chooses.valueandmonthare bindable, andonvaluechangeruns when the reader chooses. Given both,monthis the month shown; a value the app sets later shows its own month. Days beforemin, aftermaxor for whichunavailable(date)is true can be reached but not chosen, and the keyboard never leavesmin..max; avalueon such a day is treated as none. A chosen day's name ends ", selected" (selectedLabeltranslates it, aspreviousLabelandnextLabeldo the month buttons). Labels are inlocale(default"en-US", so the server and the browser agree), and the week starts onweekStart(0 = Sunday, the default; 1 for Monday). Today is the reader's own day, so it is marked (underlined) only once the page is live; with neithervaluenormonththe browser shows the reader's month. Withname, a hidden input submits the value. The server draws the month, but choosing needs JavaScript: a form that must work without it usesDatePicker. Name it withlabel, or it is named by its month; in aField, the Field's label and the month name it and its description describes it (a grid is not a labelable control, so the label'sfordoes not reach it). Every month takes six weeks' height, so paging never moves what is below. Anunavailablethat throws rules nothing out.RangeCalendarchooses a start and an end with the same grid. The first pick sets the start and previews the days to the pointer or the focused day; the second sets the end (one before the start swaps them); Escape forgets a start. A range is inclusive and never crosses a day that cannot be chosen: a second pick across one starts a new range there.valueis{ start, end }or null; a malformed, reversed or out-of-bounds one, or one across an unavailable day, is treated as none.onvaluechangeruns when a range completes, andstartName/endNamesubmit it as two inputs (empty while a new range is half chosen, as the grid shows). Withunavailable, a range wider than ten years is treated as none rather than walked a day at a time.DatePickeris the platform's<input type="date">: typing, the browser's own picker, the reader's locale,min/maxvalidation and form submission all work with no JavaScript, and a date typed before the page was interactive is kept. A form reset returns it to its first value, and the bound value follows. The browser writes the date in the reader's locale, so there is noformatoption. Field wiring asInput.
Data table
DataTable is a Table that sorts, searches and pages. It has two modes.
<!-- Its own rows: everything happens in the browser. -->
<DataTable caption="Services" {columns} rows={services} pageSize={20} bind:sort bind:query />
<!-- One page of the server's, every state at its own address (works with no JavaScript). -->
<DataTable caption="Services" {columns} rows={data.page} rowCount={data.total} pageSize={20} {...data.state}
href={(s) => `/services?sort=${s.sort ?? ""}&dir=${s.direction}&q=${encodeURIComponent(s.query)}&page=${s.page}`} />- Columns are
{ key, label, align?, sortable?, filterable?, sortValue?, compare?, format? }.format(value, row)gives the cell's text (shown and searched);cellrenders anything richer, as inTable;rowHeadernames the column whose cells name their rows. - Its own rows (
rowsalone): it sorts, searches and pages in the browser.sort,direction("ascending"or"descending"),queryandpageare bindable, and the server draws the same state, so a page that keeps them in its URL renders it there too. Changing them needs JavaScript: before it, a search typed is kept and applied once the page is live, but the sort buttons do nothing, and Enter in the search does nothing (inside your form, it submits yours). A table that must work with no JavaScript uses the server's mode withhref. - The server's rows (
rowsis one page,rowCountthe whole set's size; anyrowCountmeans this mode): it sorts and searches nothing itself. WithoutpageSize, a page is as long as therowsgiven. Withhref(state), the sortable headers and the pager are links and the search is a GET form whose hidden fields carry the rest of the state, so each state has an address and works with no JavaScript. The search field is namedqueryParam("q"); it must be the name yourhrefgives the query. In a SvelteKit app, following one keeps the reader's scroll position and focus (data-sveltekit-reset="false"; pass your own to change it). Withouthref, they callonstatechange(state)and update the bound state, and the app fetches (from either); the search asks on Enter, not on every key.busymarks the table while it waits. A search typed before the page is live stays in the field until it is submitted. - Sorting: a sortable column's header holds the control and its
<th>thearia-sort. The first press sorts ascending, the next descending. Numbers, dates and booleans compare as such, and text withIntl.Collatorinlocalewith numeric order ("item 2" before "item 10") and lower case first, so the server and every browser agree. Empty values come last either way, and equal rows keep their order.sortValue(row)orcompare(a, b)change the order. A new sort or search goes back to page 1. - Search matches every word, ignoring case and accents, in the text of each column that is not
filterable: false;filter(row, query)replaces it (a blank search always shows every row). Turn it off withsearchable={false}. - Status: one polite line below the table gives the sort, the count and the page ("Sorted by Latency, descending. 12 of 40 rows · Page 1 of 2"), because screen readers announce a changed
aria-sortunreliably. An empty table showsemptyLabel(orempty), and no matches says so. - Keys: rows are keyed by
rowKey(a column key or a function; the row'sidby default). A duplicate key is made unique, not dropped. - The pager is a page's previous and next buttons, which stay focusable at the ends (marked disabled), or with
hrefthePaginationlinks. - Names: the search is a search landmark named by the caption; an
aria-labelyou pass names the table's region. - Inside your form: only the address mode's search is a
<form>(a GET form, so it works with no JavaScript). The other modes' search is arole="search"box with noname, so a table can sit inside your own form, and once the page is live Enter in it never submits yours (with no JavaScript, Enter in any field submits its form). A table withhrefcannot sit inside a form (a form in a form is dropped by the HTML parser); place it beside yours. - Rows of your type:
DataTableis generic, socolumns: DataTableColumn<Service>[]androws: Service[]type-check with your own interface, andcell,filterandrowKeyreceive it. - Every string is a prop with an English default:
searchLabel,emptyLabel,noMatchesLabel,countLabel,sortedLabel,previousLabel,nextLabel,pageLabel,pageLinkLabel,pagesLabel(the address mode pager's name).
Workspace
None of these sets a style attribute, so all three work under a strict style-src.
<Chart title="Request latency" unit="ms" labels={times} series={[{ name: "p95", values: p95 }, { name: "p50", values: p50 }]} />
<Chart kind="bar" title="Deploys by day" labels={days} series={[{ name: "Production", values: prod }]} />
p95 this hour <Chart kind="sparkline" title="p95 latency" unit="ms" series={[{ name: "p95", values: p95 }]} />
<Carousel label="Architecture" items={cards} bind:index>
{#snippet slide(card)}<FeatureCard {...card} />{/snippet}
</Carousel>
<Resizable bind:size min={20} max={80} onresizeend={(s) => saveCookie("split", s)}>
{#snippet start()}<Editor />{/snippet}
{#snippet end()}<Inspector />{/snippet}
</Resizable>Chartis drawn by the server and needs no JavaScript.kindis"line","bar"(grouped series, from zero) or"sparkline"(one series, inline, no axes).labelsare the categories.seriesare{ name, values }, one value per label; a value that is not a number is a gap, never a zero.- The figure is named by
title(withunit). A summary line gives each series' range and last value, and "Show the data" opens the numbers as a table, so the plot itself is hidden from assistive technology. - Up to four series are told apart by a dash (lines) or a fill (solid, hatched, outlined, dotted bars) as well as a colour, in the legend too; a fifth takes the first's style again. Every series colour is at least 3:1 against the page, a surface and a panel, in both themes.
labelskeep their places (a missing one is blank), and no value past the last label is dropped. Right to left, the plot runs from the right with its labels.- Numbers use
Intl.NumberFormatinlocale, orformat. A value is written as precisely as it is given (to twelve significant digits), so an error rate of 0.0012 is not rounded to 0. The scale's ticks take as many decimals as their step needs, ortickFormat.summaryreplaces the whole summary;summaryLabel({ name, low, high, last })andnoDataLabel(name)write each series' sentence in your language, anddataLabelnames the table. With no value at all the chart is its title andemptyLabel("No data."), with no plot or table.heightis"sm","md"or"lg". In forced colours the series are drawn in the system's text colour, told apart by their dashes and fills. - The labels are HTML, so they never shrink with the chart; a label longer than its column is cut short (the data table has it whole).
Carouselis a track that scrolls and snaps a slide at a time. Touch, a trackpad and the keyboard (the track is focusable) work with no JavaScript; the buttons and the position appear once the page is live (they are kept in place before, so nothing moves). It scrolls only its own track, never the page.- Once the page is live, Previous and Next move a slide. They stay focusable at the ends, marked disabled, unless
loop. - The position ("2 of 5") is a polite status read when a scroll ends, so a swipe moves it too.
- It never moves by itself.
indexis bindable (setting it scrolls there), andperViewshows 1, 2 or 3 slides.labelnames it.slidesLabel,previousLabel,nextLabel,positionLabel,roleLabel("carousel") andslideRoleLabel("slide") translate the rest. With no items there is no track.- Starting past the first slide, Chromium draws it there; other browsers draw the first slide and scroll to it once the page is live.
- Once the page is live, Previous and Next move a slide. They stay focusable at the ends, marked disabled, unless
Resizableis two panes and the window splitter between them.directionis"horizontal"(side by side) or"vertical"(stacked); nest them for more panes.- The separator takes focus. The arrow keys along its axis move it by
step(Left and Right swap on a right-to-left page), Home and End go tominandmax, and Enter collapses the first pane and restores it. A pointer drags it. size(the first pane's share, in percent) is bindable, andonresizeendreports a finished change (only when the size changed). A click on the separator focuses it. Keep it in a cookie so your server can draw it.- The server draws the nearest 5 %, and the exact size once the page is live, so keep sizes to steps of 5 (the default
step) to avoid a small jump. Moving it needs JavaScript. - A pane scrolls, so it clips what overflows it, focus rings included: give its content a little padding.
- The separator takes focus. The arrow keys along its axis move it by
Agent and collaboration
The pieces of a conversation with people and agents. Every text prop is shown as text, never
parsed as HTML (a long hash or path wraps): pass markup as a snippet only if you made it safe.
Line breaks are kept in a Bubble's text, a Trace entry's description and detail, and a
Questionnaire review's answers;
elsewhere (names, titles, errors) they are spaces. None sets a style attribute (Message's
avatarSrc draws the photo through Avatar, once the page is live); all of them read with no
JavaScript.
<ol class="flex flex-col gap-4">
<Marker as="li" variant="ruled" text="Today" />
<Message as="li" author="Ada" timestamp={sentAt} timeZone={reader.zone} text={draft} align="end" />
<Message as="li" author="Workshop assistant" badge="Agent" timestamp={at} text={reply}>
{#snippet actions()}<Button size="sm" variant="ghost" aria-label="Copy the reply">Copy</Button>{/snippet}
</Message>
<Marker as="li" busy live text="Thinking…" />
</ol>
<Attachment name="review.pdf" size={1_500_000} state="uploading" progress={64} onremove={cancel} />
<Trace title="Checked the contract" entries={events} duration={40} />Messageshowsauthor, andbadgenames an automated author in words ("Agent"), so who spoke is never told by colour or side alone.timestamp(aDate, epoch milliseconds or an ISO 8601 string) is a<time datetime>printed intimeZoneandlocale. The zone is UTC unless you pass one, so the server and the browser print the same text: pass the reader's zone (from their profile or a cookie) for local times. A time printed in UTC says so ("10:42 AM UTC"), unless yourtimeFormatnames the zone itself.timeFormattakesIntl.DateTimeFormatoptions (the short time by default). A locale the runtime rejects or lacks is en-US in the same zone (as everywhere in the package, not the runtime's own default); a zone it rejects, UTC. Pass a locale both your server and your readers' browsers support, or they print different words. A date with no time ("2026-11-27") is printed as that date.- The body is
text, in aBubble(primarywhenalign="end", elseneutral;variantchanges it), or yourchildren.actionsare yours: name each one. continuedis a later message in one author's run: its header is kept for assistive technology only and its avatar's place stays empty. The avatar is decoration (the header names the author):avatarSrcgives it a photo,avatar={false}drops it, a snippet replaces it.as="li"(or"article") puts it in your list. It is a layout, not a live region: announcing new messages isMessageScroller's.
Bubbleis one turn on its own (onlytextkeeps its line breaks; your markup's own whitespace is not text):align("start","end"),variant("neutral","primary","outline","danger"), at most 65 characters and 80 % of its row wide. It names no speaker; put it in aMessage.reactionsare read-only,{ symbol, label, count? }, each read by its label and count (reactionsLabelnames the list); one with no label is dropped. For reactions people can press, render your own buttons in the message'sactions.Markeris a note or divider between turns:variant"plain","ruled"(rules either side, its text still read: it is not aseparator) or"border", with aniconor abusyring.livemakes it a polite status: use it only for a real update ("Thinking…"), never for history, or a reader hears the whole transcript on load. Keep a live Marker mounted and change its text: not every screen reader announces a status that arrives already holding its text. As a list item (as="li") the status is its text, so the item stays in its list.Attachmentis a file's name, format (its extension, orformat, which is also read aloud when the name does not say it; a name with no extension shows "FILE" unless you passformat, in your language), size (sizein bytes, in SI units inlocale) andstate:"queued","uploading","processing","error"or"done", always in words (stateLabelstranslates them).- While uploading, a native
<progress>showsprogress. Without it (the size is unknown) a band slides along the track, or stripes run its length under reduced motion; never a bar that reads as full or empty. In forced colours it is drawn in the system's colours. - A change of state is announced politely with the file's name and, for an error,
error. The component does not announce the percentage (some screen readers read a progress bar's changes themselves). - The name links to
hrefonly for anhttp:,https:,blob:or relative address; anything else (javascript:,data:) shows it as text. - Remove (
onremove) and Retry (onretry, on an error) appear once the page is live, each named with the file ("Remove review.pdf");removeLabelandretryLabeltranslate them. Retry takes itself away, so it moves the focus to Remove (or the file's name) first. Youractionsalways render, so a page with no JavaScript can offer a form's button. - When a Remove takes the row away, move focus somewhere sensible (the list, the next file): the component cannot, since the app removes it.
- File policy (types, sizes) and scanning are your server's: the component reads no file.
- While uploading, a native
Traceis the recorded events of a run: a<details>, closed unlessopen(bindable), that opens with no JavaScript.- Its summary is
title, the run's state in words and, if you give it,duration: the entries' durations are never summed, since steps may overlap. entriesare{ id?, title, status?, description?, detail?, duration?, source? }.statusis"pending","running","success","warning","error","skipped"or"cancelled", each an icon and a word (statusLabels); an entry with no status (or an unknown one) claims none.sourceis where it came from ("compiler", a tool's name);detailis preformatted text (output, a payload) in a closed disclosure. Each is named "Show details" and its entry's title (detailLabel; a function given the title returns the whole name).- The state is
state, or the entries': any running, else any error, else any warning, else any pending, else any cancelled, else success. With no entries it saysemptyLabel("Nothing recorded yet.") and claims no state. - A later entry with the same
idupdates that entry in place, so you can append events as they arrive (a step's start, then its outcome) and a duplicate event is harmless. Give entries ids whenever the list can change other than at its end: without one, an entry is known by its title and which occurrence of it it is. - Durations read in the largest unit they reach: "12 ms", "1.2 sec", "1.5 min".
- It shows only what you give it: redact secrets and tokens before they reach it, and pass recorded actions and outcomes, never a model's private reasoning. It has no live region: a running trace updates silently.
- Its summary is
MessageScrolleris a transcript that keeps the reader's place. Give it a height (a class such ash-96, or a flex parent). It draws its own frame (a border and rounded corners), so give it a height, not a border: a border of yours draws a frame inside a frame.<MessageScroller label="Release thread" class="h-96" {messages} hasEarlier={more} onLoadEarlier={loadOlder} earlierHref="?before={oldest}" />- It opens at the latest message, with no JavaScript too: the scroller is reversed, so its scroll origin is the latest message while the content keeps its reading order.
dayDividersputs a ruled Marker naming the day before each day's first message, intimeZone(UTC unless given) andlocale. Pass a function for your own words: it is given the ISO day and returns the text ((day) => day === today ? "Today" : ""; an empty string keeps the date). It works with your ownmessagesnippet too. A message with notimestampstarts no day; a day that comes back (messages out of order) gets another divider.- A divider is an item of the transcript's list, so a screen reader counts it ("list, 32 items" for 28 messages) and reads its date as an item.
- Words that depend on the clock ("Today") must come out the same on the server and in the
browser: work out today from a date the server sends, in the same
timeZone, not from each side's own clock, or the label can differ when the page hydrates. - It follows new messages, and a reply that grows as it streams, only while the reader is at
or near the latest (
threshold, 48 px by default). Withfollow={false}it does not move the reader within the threshold, though at the very end the browser keeps the latest message in view. Away from the latest, the reader's place is kept, and Jump to latest shows how many messages arrived since ("Jump to latest, 3 new";latestLabel,unseenLabel, or alatestLabelfunction given the count that writes the whole text). It moves the focus to the transcript as it goes. History added above keeps the place too. - Each message is drawn inside the scroller's own
<li>: aMessageorMarkeryour snippet renders must not takeas="li"(a list item in a list item is split by the HTML parser, and the page fails to hydrate). messagesare keyed byid, compared as strings (1and"1"are one message; a repeatedidupdates that message in place; one with noidis dropped) and drawn by yourmessagesnippet, or a `Message
