# Zest (@limerdev/zest) > Svelte 5 components for Limer's internal and admin apps, built on Bits UI and styled with Tailwind 4. Every component maps to a Bits UI component of the same name, with the same parts and props. A component with parts is a namespace with Bits UI's parts (``, ``, and its prop types: `Dialog.ContentProps`); a component of one part is imported by name (` ``` Props of `Button`: - `disabled` (`null | false | true`, default `false`) - `href` (`string | null`, default `undefined`) - `loading` (`boolean`, default `false`): Waiting for the action it started: a spinner shows (in place of the icon of an `icon`-size button), it is marked busy and unavailable, and clicks do nothing. Unlike `disabled`, it keeps keyboard focus. - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `type` (`null | "button" | "submit" | "reset"`, default `'button'`) - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Example: Variants The variants, by the theme's colour roles: primary for the main action, error for deleting, secondary, neutral and outline for the rest, ghost in toolbars, link for a navigation that looks like text. ```svelte ``` Example: Sizes sm, default and lg follow the theme's field size; the icon sizes are square. Give an icon-only button an aria-label. ```svelte ``` Example: With an icon An icon before the text gets a little less padding. ```svelte ``` Example: Link and disabled With href the button is a link. A disabled link loses its href and leaves the tab order. ```svelte ``` Example: Loading loading shows a spinner while the action runs: the button keeps focus, is marked busy, and ignores clicks until it is done. ```svelte ``` ### ButtonGroup Buttons joined into one control. `` (`orientation`: `horizontal` or `vertical`) holds `Button`s, triggers, an `Input`, a `ButtonGroup.Text` (a label or unit in a box) and `ButtonGroup.Separator`s, and joins them: square inner corners, one border between neighbours. It is a `group`; name it with `aria-label`. Groups inside a group keep a gap. - Category: Actions - Import: `import { ButtonGroup } from '@limerdev/zest'` - Exports: `ButtonGroup.Root`, `ButtonGroup.Text`, `ButtonGroup.Separator` - Use for: A split button (an action and a menu of its variants), a pager (Previous, Next), a zoom control, a toolbar segment, an input with its action. - Don't: Choosing one of several options: use `ToggleGroup`. A row of unrelated actions: put `Button`s side by side with a gap. Tabs between views: use `Tabs`. ```svelte Schedule ``` Props of `ButtonGroup.Root`: - `orientation` (`"horizontal" | "vertical"`, default `'horizontal'`): Which way the buttons run: side by side, or stacked. Props of `ButtonGroup.Separator`: - `decorative` (`boolean`, default `true`): Whether the separator is decorative and should be hidden from assistive technologies. - `orientation` (`"horizontal" | "vertical"`, default `'vertical'`): The orientation of the separator. Example: Split button A split button: the action, and a menu of its other ways. ```svelte Schedule Send a copy to me ``` Example: Pager Outline buttons with ButtonGroup.Text between them: one border between neighbours. ```svelte Page {current} of {last} ``` Example: With input An Input and its action, joined. Groups inside a group keep a gap. ```svelte ``` Example: Vertical orientation="vertical" stacks the buttons. ```svelte ``` ### Calendar A month calendar to pick a date: `type="single"` binds a `DateValue` (a `CalendarDate` from `@limerdev/zest/date`, all of `@internationalized/date`), `type="multiple"` a `DateValue[]`. `minValue`, `maxValue`, `isDateDisabled`, `isDateUnavailable`, `numberOfMonths`, `weekStartsOn`, `locale`. With no children it draws the header and month grids; the parts (`Header`, `Heading`, `PrevButton`, `NextButton`, `Months`, `Grid`, `GridHead`, `GridBody`, `GridRow`, `HeadCell`, `Cell`, `Day`) are there for custom layouts. Arrow keys move between days, Page Up and Down between months, Enter or Space picks. - Category: Data input - Import: `import { Calendar } from '@limerdev/zest'` - Bits UI: `Calendar`, https://bits-ui.com/docs/components/calendar - Exports: `Calendar.Root`, `Calendar.Header`, `Calendar.Heading`, `Calendar.PrevButton`, `Calendar.NextButton`, `Calendar.Months`, `Calendar.Grid`, `Calendar.GridHead`, `Calendar.GridBody`, `Calendar.GridRow`, `Calendar.HeadCell`, `Calendar.Cell`, `Calendar.Day` - Use for: Picking a date where seeing the month helps: a deadline, an absence day, a delivery date. In a form, `DatePicker` puts it in a popover. - Don't: A date people know and type (a birth date): use `DateField`. A range of dates: use `RangeCalendar`. ```svelte ``` Props of `Calendar.Root`: - `calendarLabel` (`string`): This label is exclusively used for accessibility, remaining hidden from the page. It's read by screen readers when the calendar is opened. The current month and year are automatically appended to the label, so you only need to provide the base label. For instance: - 'Date of birth' will be read as 'Date of birth, January 2021' if the current month is January 2021. - 'Appointment date' will be read as 'Appointment date, January 2021' if the current month is January 2021. - 'Booking date' will be read as 'Booking date, January 2021' if the current month is January 2021. - `disabled` (`boolean`, default `false`): Whether or not the calendar is disabled. - `disableDaysOutsideMonth` (`boolean`, default `false`): Whether to disable the selection of days outside the current month. By default, days outside the current month are rendered to fill the calendar grid, but they are not selectable. Setting this prop to `true` will disable this behavior. - `fixedWeeks` (`boolean`, default `false`): Display 6 weeks per month, regardless the month's number of weeks. This is useful for displaying a consistent calendar, where the size of the calendar doesn't change month to month. To display 6 weeks per month, you will need to render out the previous and next month's dates in the calendar as well. - `initialFocus` (`boolean`): If `true`, the calendar will focus the selected day, today, or the first day of the month in that order depending on what is visible when the calendar is mounted. - `isDateDisabled` (`DateMatcher`): A function that receives a date and returns `true` or `false` to indicate whether the date is disabled. - `isDateUnavailable` (`DateMatcher`): Dates matching the provided matchers are marked as "unavailable." Unlike disabled dates, users can still focus and select unavailable dates. However, selecting an unavailable date renders the date picker as invalid. For example, in a calendar for booking appointments, you might mark already booked dates as unavailable. These dates could become available again before the appointment date, allowing users to select them to learn more about the appointment. `[data-unavailable]` - applied to unavailable dates - `locale` (`string`, default `'en'`): The default locale setting. - `maxDays` (`number`, default `undefined`): The maximum number of days that can be selected in multiple mode. When set, users cannot select more dates than this number. - `maxValue` (`DateValue`): The maximum date that can be selected in the calendar. - `minValue` (`DateValue`): The minimum date that can be selected in the calendar. - `monthFormat` (`"numeric" | "long" | "short" | "narrow" | "2-digit" | ((month: number) => string)`, default `"long"`): The format of the month names in the calendar. - `numberOfMonths` (`number`, default `1`): Determines the number of months to display on the calendar simultaneously. For navigation between months, refer to the `pagedNavigation` prop. - `onPlaceholderChange` (`OnChangeFn`): A callback function called when the placeholder value changes. - `onValueChange` (`OnChangeFn | OnChangeFn`): A callback function called when the value changes. - `pagedNavigation` (`boolean`, default `false`): Applicable only when `numberOfMonths` is greater than 1. Controls whether to use paged navigation for the next and previous buttons in the date picker. With paged navigation set to `true`, clicking the next/prev buttons changes all months in view. When set to `false`, it shifts the view by a single month. For example, with `pagedNavigation` set to `true` and 2 months displayed (January and February), clicking the next button changes the view to March and April. If `pagedNavigation` is `false`, the view shifts to February and March. - `placeholder` (`DateValue`, default `the current date`, bindable): The placeholder date, used to control the view of the calendar when no value is present. - `preventDeselect` (`boolean`, default `false`): Whether or not users can deselect a date once selected without selecting another date. - `readonly` (`boolean`, default `false`): Whether the calendar is readonly. When true, the user will be able to focus and navigate the calendar, but will not be able to select dates. - `type` (`"multiple" | "single"`, required): The type of calendar. If set to `'single'`, the calendar will only allow a single date to be selected. If set to `'multiple'`, the calendar will allow multiple dates to be selected. - `value` (`DateValue | DateValue[]`, bindable): The value of the selected date in the calendar. The value of the selected dates in the calendar. - `weekdayFormat` (`"long" | "short" | "narrow"`, default `'short'`): How the string representation of the weekdays provided via the `weekdays` state store should be formatted. ```md - "long": "Sunday", "Monday", "Tuesday", etc. - "short": "Sun", "Mon", "Tue", etc. - "narrow": "S", "M", "T", etc. ``` - `weekStartsOn` (`0 | 1 | 2 | 3 | 4 | 5 | 6`, default `0 (Sunday)`): The day of the week to start the calendar on, which must be a number between 0 and 6, where 0 is Sunday and 6 is Saturday. - `yearFormat` (`"numeric" | "2-digit" | ((year: number) => string)`, default `"numeric"`): The format of the year names in the calendar. Props of `Calendar.Cell`: - `date` (`DateValue`, required): The date value of the cell. - `month` (`DateValue`, required): The month DateValue that this cell is being rendered in. Example: Basic A single date. Arrow keys move between days, Page Up and Down between months. ```svelte

Picked: {date?.toString() ?? 'nothing'}

``` Example: Two months and limits numberOfMonths shows several; minValue and isDateUnavailable limit the choice. Date helpers such as isWeekend come from @limerdev/zest/date, all of @internationalized/date. ```svelte isWeekend(value, 'en-GB')} class="rounded-box border-(length:--border) border-border bg-base-100 shadow-field" /> ``` ### Card A surface that groups related content: `` holds an optional `Card.Figure` (an image that runs to the edges; `inset` pads it), a `Card.Header` (a `Card.Title` heading, at `level` 3 by default; a `Card.Description`; a `Card.Action` in the end corner), a `Card.Content` and a `Card.Footer`. `variant`: `default` (border and shadow), `outline`, `dash` (an empty or drop area), `soft` (a fill, no border). `size`: `sm`, `default`, `lg` (padding, gaps and title). `layout`: the figure above or below the text (`vertical`), beside it (`horizontal`, or `responsive` from the `md` breakpoint), or behind it with a scrim (`overlay`); beside or behind, the text goes in a `Card.Body`. - Category: Layout - Import: `import { Card, cardVariants } from '@limerdev/zest'` - Exports: `Card.Root`, `Card.Figure`, `Card.Body`, `Card.Header`, `Card.Title`, `Card.Description`, `Card.Action`, `Card.Content`, `Card.Footer`, `cardVariants` - Use for: A block of a page about one thing: a customer's details, a summary figure, a settings section, an item in a grid, a product or article with its image. - Don't: Cards inside cards, or a card around a whole page: use spacing and `Separator`. A clickable card: put a link or button inside it instead of making the card the target. ```svelte Acme AB Customer since 2021 12 open invoices, 48 200 kr due. ``` Props of `Card.Root`: - `layout` (`"horizontal" | "vertical" | "responsive" | "overlay"`, default `'vertical'`): Where a `Card.Figure` goes: above or below the text (`vertical`), beside it (`horizontal`), beside it from the `md` breakpoint (`responsive`), or behind it as the background (`overlay`). Beside or behind, put the text in a `Card.Body`. - `size` (`"default" | "sm" | "lg"`, default `'default'`): The padding, the gaps and the title's size. - `variant` (`"outline" | "default" | "dash" | "soft"`, default `'default'`): The look: a border and a shadow (`default`), a border only (`outline`), a dashed border (`dash`, for an empty or drop area), or a soft fill without a border (`soft`). Props of `Card.Figure`: - `inset` (`boolean`, default `false`): Pad the figure and round the image, instead of running it to the card's edges. Props of `Card.Title`: - `level` (`1 | 2 | 3 | 4 | 5 | 6`, default `3`): The heading level, for the page's outline. Example: Image A figure that runs to the card's edges, a header with a badge, and actions. ```svelte Hills at sunset Autumn retreat 14–16 October, Åre Booked Three days, 24 people. The invoice goes out on 1 October. ``` Example: Header and actions No figure: a header with a title, description and an action; content; a footer. ```svelte Acme AB Customer since 2021 12 open invoices, 48 200 kr due. ``` Example: Variants variant: a border and shadow (default), a border only, a dashed border, a soft fill. ```svelte
{#each variants as variant (variant)} {variant} variant="{variant}" {/each}
``` Example: Sizes size: the padding, the gaps and the title. ```svelte
{#each sizes as size (size)} Size {size} size="{size}" Padding and gaps follow the size. {/each}
``` Example: Side layout="horizontal" puts the figure beside a Card.Body; "responsive" does so from md. ```svelte
A lake below mountains Lakeside office Room for 12, from 1 March Desks, two meeting rooms and a kitchen. Green fields Inset figure Padded, with rounded corners; beside the text from md.
``` Example: Overlay layout="overlay": the figure is the background, with a scrim behind the text. ```svelte Spring kick-off The whole company, 3 April ``` Example: Figures Summary figures in a grid of small cards: only a header and content. ```svelte
{#each figures as figure (figure.label)} {figure.label} {figure.change} {figure.value} {/each}
``` ### Checkbox A checkbox with `bind:checked`, and `bind:indeterminate` for a partly checked group. With `name` it submits with a form. Inside a `Field` it takes its id, label, description, error and disabled state from the Field; use `orientation="horizontal"` to put the label beside it. - Category: Data input - Import: `import { Checkbox } from '@limerdev/zest'` - Bits UI: `Checkbox`, https://bits-ui.com/docs/components/checkbox - Exports: `Checkbox` - Use for: An on/off choice that takes effect when a form is submitted, or one of several independent options. - Don't: A setting that applies at once: use `Switch`. Choosing one of several options: use `RadioGroup`. A Checkbox without a label. ```svelte Billable ``` Props of `Checkbox`: - `checked` (`boolean`, default `false`, bindable): The checked state of the checkbox. It can be one of: - `true` for checked - `false` for unchecked - `disabled` (`null | false | true`, default `false`): Whether the checkbox is disabled. - `form` (`string`, default `undefined`): The id of the form to link the checkbox button and hidden input to. - `indeterminate` (`boolean`, default `false`, bindable): Whether the checkbox is in an indeterminate state or not. - `name` (`any`, default `undefined`): The name of the checkbox used in form submission. If not provided, the hidden input will not be rendered. - `onCheckedChange` (`OnChangeFn`): A callback function called when the checked state changes. - `onIndeterminateChange` (`OnChangeFn`): A callback function called when the indeterminate state changes. - `readonly` (`null | false | true`, default `false`): Whether the checkbox is read only. If readonly, the checkbox will be focusable by the user, but will not be able to be checked/unchecked. - `required` (`boolean`, default `false`): Whether the checkbox is required (for form validation). - `value` (`string`, default `undefined`): The value of the checkbox used in form submission and to identify the checkbox when in a `Checkbox.Group`. If not provided while in a `Checkbox.Group`, the checkbox will use a random identifier. Example: Basic Put a Checkbox and its label in a horizontal Field; clicking the label toggles it. ```svelte Billable ``` Example: With a description Field.Content stacks the label and its description beside the checkbox. ```svelte Send a copy to the customer They get the invoice as a PDF the day it is sent. ``` Example: Select all indeterminate shows that only some of a group are checked. ```svelte Submit hours for All days
{#each days as day (day.name)} {day.name} {/each}
``` ### Collapsible One section that opens and closes: `` (`bind:open`) holds a `Collapsible.Trigger` (a button; render your own with the `child` snippet) and a `Collapsible.Content`, which slides open. - Category: Layout - Import: `import { Collapsible } from '@limerdev/zest'` - Bits UI: `Collapsible`, https://bits-ui.com/docs/components/collapsible - Exports: `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content` - Use for: Optional detail under something visible: advanced options in a form, the lines behind a total, older entries. - Don't: Several sections under headings: use `Accordion`. Content everyone needs: show it. ```svelte Advanced options … ``` Props of `Collapsible.Root`: - `disabled` (`boolean`, default `false`): Whether the collapsible is disabled. - `onOpenChange` (`OnChangeFn`): A callback function called when the open state changes. - `onOpenChangeComplete` (`OnChangeFn`): A callback function called when the open state changes complete. - `open` (`boolean`, default `false`, bindable): Whether the collapsible is open. Props of `Collapsible.Trigger`: - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Props of `Collapsible.Content`: - `forceMount` (`boolean`, default `false`): Whether to force mount the content to the DOM. - `hiddenUntilFound` (`boolean`, default `true`): Whether to allow the browser to expand the content when searching for content within the panel via the browser's built-in search functionality. When `true`, this prop will override the `forceMount` prop. Example: Basic Optional detail under a total. The trigger is your own Button through child. ```svelte

Invoice 1042 · 12 400 kr

  • Development · 24 h · 9 600 kr
  • Design · 7 h · 2 800 kr
``` ### Combobox A text input with a list of options, filtered as the user types: `` (`type="single"` or `"multiple"`, `bind:value`, `items`, `name`) holds a `Combobox.Input` (styled like `Input`, with a button that opens the list) and a `Combobox.Content`. Given `items`, `` draws those whose label contains the typed text, or `emptyText` when none do. For your own filtering (a search on the server, say) or markup, give the content `Combobox.Item`s (`value`, `label`), optionally in `Combobox.Group`s with a `Combobox.GroupHeading`, and read the typed text from the input's `oninput`. Arrow keys move, Enter chooses, Escape closes. Inside a `Field` the input is labelled, described and marked invalid by the Field. - Category: Data input - Import: `import { Combobox } from '@limerdev/zest'` - Bits UI: `Combobox`, https://bits-ui.com/docs/components/combobox - Exports: `Combobox.Root`, `Combobox.Input`, `Combobox.Trigger`, `Combobox.Content`, `Combobox.Item`, `Combobox.Group`, `Combobox.GroupHeading`, `Combobox.Portal` - Use for: Choosing from a long list by typing: a customer, a project, a country. - Don't: A short list people don't need to search: use `Select`. Running commands: use `Command`. ```svelte Customer ``` Props of `Combobox.Root`: - `allowDeselect` (`boolean`): Whether to allow the user to deselect an item by clicking on an already selected item. This is only applicable to `type="single"` selects/comboboxes. - `disabled` (`boolean`, default `false`): Whether the combobox is disabled. - `inputValue` (`string`): A read-only value that can be used to programmatically update the input value. This is useful for updating the displayed label/input when the value changes outside of Bits UI. - `items` (`{ value: string; label: string; disabled?: boolean | undefined; }[]`): Optionally provide an array of `value` and `label` pairs that will be used to match and trigger selection when the trigger is focused and a key is pressed while the content is closed. It's also used to handle form autofill. By providing this value, you enable selecting a value when the trigger is focused and a key is pressed without the content being open, similar to how a native `
``` ### DropdownMenu A menu of actions or options opened from a button: `` holds a `DropdownMenu.Trigger` and a `DropdownMenu.Content` of `DropdownMenu.Item`s (`onSelect`, `variant="error"`, `DropdownMenu.Shortcut` for a key hint). It also takes `CheckboxItem`s, a `RadioGroup` of `RadioItem`s, `Group`s with a `GroupHeading`, `Label`s, `Separator`s and submenus (`Sub`, `SubTrigger`, `SubContent`). Arrow keys move, Enter or Space chooses, typing jumps to an item, Escape closes and returns focus. - Category: Actions - Import: `import { DropdownMenu } from '@limerdev/zest'` - Bits UI: `DropdownMenu`, https://bits-ui.com/docs/components/dropdown-menu - Exports: `DropdownMenu.Root`, `DropdownMenu.Trigger`, `DropdownMenu.Content`, `DropdownMenu.Portal`, `DropdownMenu.Item`, `DropdownMenu.CheckboxItem`, `DropdownMenu.CheckboxGroup`, `DropdownMenu.RadioGroup`, `DropdownMenu.RadioItem`, `DropdownMenu.Group`, `DropdownMenu.GroupHeading`, `DropdownMenu.Label`, `DropdownMenu.Separator`, `DropdownMenu.Shortcut`, `DropdownMenu.Sub`, `DropdownMenu.SubTrigger`, `DropdownMenu.SubContent` - Use for: The actions for one thing, out of the way: a row's "more" button, an account menu, view options with checkbox or radio items. - Don't: Choosing a value for a form: use `Select`. Navigation between pages: use links or `NavigationMenu`. The only way to reach an important action: show it as a `Button`. ```svelte Actions Edit Duplicate Delete ``` Props of `DropdownMenu.Root`: - `dir` (`"ltr" | "rtl"`, default `"ltr"`): The direction of the site. - `onOpenChange` (`OnChangeFn`): A callback that is called when the menu is opened or closed. - `onOpenChangeComplete` (`OnChangeFn`): A callback that is called when the menu is opened or closed. - `open` (`boolean`, default `false`, bindable): The open state of the menu. Props of `DropdownMenu.Trigger`: - `disabled` (`null | false | true`, default `false`): Whether the trigger is disabled. - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Props of `DropdownMenu.Content`: - `align` (`"start" | "center" | "end"`): The preferred alignment of the anchor to render against when open. This may change when collisions occur. - `alignOffset` (`number`): An offset in pixels from the "start" or "end" alignment options. - `arrowPadding` (`number`): This describes the padding between the arrow and the edges of the floating element. If your floating element has border-radius, this will prevent it from overflowing the corners. - `avoidCollisions` (`boolean`, default `true`): When `true`, overrides the `side` and `align` options to prevent collisions with the boundary edges. - `collisionBoundary` (`Arrayable`): A boundary element or array of elements to check for collisions against. - `collisionPadding` (`number | Partial>`, default `8`): The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. - `customAnchor` (`string | HTMLElement | Measurable | null`): Use an element other than the trigger to anchor the content to. If provided, the content will be anchored to the provided element instead of the trigger. You can pass a selector string or an HTMLElement. - `dir` (`"ltr" | "rtl"`): The text direction of the content. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): Whether to force mount the component. - `hideWhenDetached` (`boolean`) - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `loop` (`boolean`, default `false`): When `true`, the menu will loop through items when navigating with the keyboard. - `onCloseAutoFocus` (`EventCallback`): Event handler called when auto-focusing on close. Can be prevented. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `onOpenAutoFocus` (`EventCallback`): Event handler called when auto-focusing on open. Can be prevented. - `portalProps` (`PortalProps`): Props for the portal the content renders in: `to` (the element to render in, the body by default) and `disabled` (render in place). - `preventOverflowTextSelection` (`boolean`, default `true`): Passing `true` will prevent the overflow of text selection outside the element, provided the element is the top layer. - `preventScroll` (`boolean`, default `true`): Whether to prevent scrolling the body when the content is open. Whether to prevent body scrolling when the content is open. - `side` (`"top" | "right" | "bottom" | "left"`): The preferred side of the anchor to render against when open. Will be reversed when collisions occur. - `sideOffset` (`number`, default `4`): The distance in pixels from the anchor to the floating element. - `sticky` (`"partial" | "always"`) - `strategy` (`"absolute" | "fixed"`): The positioning strategy to use for the floating element. - `trapFocus` (`boolean`, default `false`): Whether focus is trapped within the focus scope. - `updatePositionStrategy` (`"always" | "optimized"`, default `"optimized"`): "optimized" will only update the position when necessary, while "always" will update the position on each animation frame, which is useful if the floating content is following something like a mouse cursor. Props of `DropdownMenu.Portal`: - `disabled` (`boolean`, default `false`): Disable portalling and render the component inline - `to` (`PortalTarget`, default `document.body`): Where to portal the content to. Props of `DropdownMenu.Item`: - `closeOnSelect` (`boolean`, default `true`): Whether or not the menu item should close when selected. - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. - `variant` (`"error" | "default"`, default `'default'`): `error` colours the item for deleting. Props of `DropdownMenu.CheckboxItem`: - `checked` (`boolean`, default `false`, bindable): The checked state of the checkbox. It can be one of: - `true` for checked - `false` for unchecked - `closeOnSelect` (`boolean`, default `false`): Whether or not the menu item should close when selected. - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `indeterminate` (`boolean`, default `false`, bindable): Whether the checkbox is in an indeterminate state or not. - `onCheckedChange` (`OnChangeFn`): A callback that is fired when the checked state changes. - `onIndeterminateChange` (`OnChangeFn`): A callback function called when the indeterminate state changes. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. - `value` (`string`): The value of the checkbox item when used in a checkbox group. Props of `DropdownMenu.CheckboxGroup`: - `onValueChange` (`OnChangeFn`): A callback that is fired when the selected checkbox items change. - `value` (`string[]`, default `[]`, bindable): The values of the selected checkbox items. Supports two-way binding with `bind:value`. Props of `DropdownMenu.RadioGroup`: - `onValueChange` (`OnChangeFn`): A callback that is fired when the selected radio item changes. - `value` (`string`, default `''`, bindable): The value of the selected radio item. Supports two-way binding with `bind:value`. Props of `DropdownMenu.RadioItem`: - `closeOnSelect` (`boolean`, default `false`): Whether or not the menu item should close when selected. - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. - `value` (`string`, required): The value of the radio item. Props of `DropdownMenu.GroupHeading`: - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. Props of `DropdownMenu.Label`: - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. Props of `DropdownMenu.Sub`: - `onOpenChange` (`OnChangeFn`): A callback that is called when the menu is opened or closed. - `onOpenChangeComplete` (`OnChangeFn`): A callback that is called when the menu finishes opening/closing animations. - `open` (`boolean`, default `false`, bindable): The open state of the menu. Props of `DropdownMenu.SubTrigger`: - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `openDelay` (`number`, default `100`): The amount of time in ms from when the mouse enters the subtrigger until the submenu opens. This is useful for preventing the submenu from opening as a user is moving their mouse through the menu without a true intention to open that submenu. To disable the behavior, set it to `0`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. Props of `DropdownMenu.SubContent`: - `align` (`"start" | "center" | "end"`): The preferred alignment of the anchor to render against when open. This may change when collisions occur. - `alignOffset` (`number`): An offset in pixels from the "start" or "end" alignment options. - `arrowPadding` (`number`): This describes the padding between the arrow and the edges of the floating element. If your floating element has border-radius, this will prevent it from overflowing the corners. - `avoidCollisions` (`boolean`, default `true`): When `true`, overrides the `side` and `align` options to prevent collisions with the boundary edges. - `collisionBoundary` (`Arrayable`): A boundary element or array of elements to check for collisions against. - `collisionPadding` (`number | Partial>`, default `8`): The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. - `customAnchor` (`string | HTMLElement | Measurable | null`): Use an element other than the trigger to anchor the content to. If provided, the content will be anchored to the provided element instead of the trigger. You can pass a selector string or an HTMLElement. - `dir` (`"ltr" | "rtl"`): The text direction of the content. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): Whether to force mount the component. - `hideWhenDetached` (`boolean`) - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `loop` (`boolean`, default `false`): When `true`, the menu will loop through items when navigating with the keyboard. - `onCloseAutoFocus` (`EventCallback`): Event handler called when auto-focusing on close. Can be prevented. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `onOpenAutoFocus` (`EventCallback`): Event handler called when auto-focusing on open. Can be prevented. - `preventOverflowTextSelection` (`boolean`, default `true`): Passing `true` will prevent the overflow of text selection outside the element, provided the element is the top layer. - `side` (`"top" | "right" | "bottom" | "left"`): The preferred side of the anchor to render against when open. Will be reversed when collisions occur. - `sideOffset` (`number`): The distance in pixels from the anchor to the floating element. - `sticky` (`"partial" | "always"`) - `strategy` (`"absolute" | "fixed"`): The positioning strategy to use for the floating element. - `trapFocus` (`boolean`, default `false`): Whether focus is trapped within the focus scope. - `updatePositionStrategy` (`"always" | "optimized"`, default `"optimized"`): "optimized" will only update the position when necessary, while "always" will update the position on each animation frame, which is useful if the floating content is following something like a mouse cursor. Example: Actions A row's actions. variant="error" marks the dangerous one; Shortcut shows a key hint. ```svelte (last = 'Edit')}> Edit ⌘E (last = 'Duplicate')}> Duplicate (last = 'Delete')}> Delete

Chose: {last}

``` Example: View options Checkbox items toggle settings, a radio group picks one; both keep the menu open. ```svelte View Show Archived projects Billable only Sort by Name Last updated Hours logged

{archived ? 'With' : 'Without'} archived, {billableOnly ? 'billable only' : 'all'}, by {sort}

``` Example: Groups and submenus Groups with headings, an inset label, and a submenu (Sub, SubTrigger, SubContent). ```svelte Anna Berg Account Profile Settings Switch organisation Limer Acme AB Sign out ``` ### Empty What a place shows when it has nothing yet: a list without rows, a search without results, a page the user has no access to. `` centres an `Empty.Media` (an icon in a tile with `variant="icon"`, or an image; hidden from screen readers), an `Empty.Title` (a heading, at `level` 3 by default), an `Empty.Description` and an `Empty.Content` with what to do next. Give the root a border (`border border-dashed`) to mark out an area. - Category: Feedback - Import: `import { Empty } from '@limerdev/zest'` - Exports: `Empty.Root`, `Empty.Media`, `Empty.Title`, `Empty.Description`, `Empty.Content` - Use for: An empty table or list, no search results, the first visit to a feature: say what is missing and how to fill it. - Don't: An error the user can fix: use `Alert`. A place that is still loading: use `Skeleton` or `Spinner`, then Empty once you know it's empty. ```svelte No invoices yet Invoices you create or import show up here. ``` Props of `Empty.Media`: - `variant` (`"default" | "icon"`, default `'default'`): `icon` sets an icon in a tile of the theme's surface; `default` shows the children (an image, an avatar) as they are. Props of `Empty.Title`: - `level` (`1 | 2 | 3 | 4 | 5 | 6`, default `3`): The heading level, for the page's outline. Example: No rows An empty list: an icon in a tile, what is missing, and the action that fills it. ```svelte No invoices yet Invoices you create or import show up here. ``` Example: No results No search results, in a dashed area: say what was searched and how to widen it. ```svelte No customers match “acme ltd” Check the spelling, or search by organisation number. ``` ### Field A form field: `Field` holds a `Field.Label`, one control (`Input` …) and an optional `Field.Description` and `Field.Error`. It wires them for you: the label points at the control, the description and a shown error describe it, and a shown error (or `invalid`) marks it `aria-invalid`. `disabled` disables the control. `Field.Set` with a `Field.Legend` groups related fields; `Field.Group` stacks fields; `orientation` puts the label beside the control. - Category: Data input - Import: `import { Field } from '@limerdev/zest'` - Exports: `Field.Root`, `Field.Set`, `Field.Legend`, `Field.Group`, `Field.Content`, `Field.Label`, `Field.Title`, `Field.Description`, `Field.Error` - Use for: Every labelled form control, so labels, help text and errors are announced with it. - Don't: Setting `id`, `for`, `aria-describedby` or `aria-invalid` by hand inside a Field: it does that. More than one control in a `Field`: use one Field per control, in a `Field.Group`. Error text in a `Field.Description`: use `Field.Error`. ```svelte Project Name Shown in the sidebar and in emails. ``` Props of `Field.Root`: - `disabled` (`boolean`, default `false`): Disable the control and dim the field. - `invalid` (`boolean`, default `false`): Mark the control invalid without an error message (a shown `Field.Error` does it too). - `orientation` (`"horizontal" | "vertical" | "responsive"`, default `'vertical'`): Where the label goes: above the control (`vertical`), beside it (`horizontal`), or beside it when the field group is wide enough (`responsive`). Props of `Field.Legend`: - `variant` (`"legend" | "label"`, default `'legend'`): `legend` for a section heading, `label` for a legend that names a group of choices like a label. Props of `Field.Error`: - `errors` (`FieldErrorItem[]`): Validation errors, as form libraries return them; their messages are listed. Example: Label description and error The Field wires its label, description and error to the control: leave the field to see the error appear and the input turn invalid. ```svelte Project name (touched = true)} placeholder="Zest" /> Shown in the sidebar and in emails. ``` Example: Several errors and disabled Several errors show as a list. disabled on the Field disables its control. ```svelte
Password Customer number Set when the customer is created.
``` Example: A form Field.Set and Field.Legend group related fields. responsive puts labels in a column beside their controls when there is room; horizontal puts a label beside its control. ```svelte
event.preventDefault()}> Billing Where invoices are sent. Company Invoice email VAT number Leave empty outside the EU.
``` ### FileDropzone Picks files: `` with `bind:files` (a `File[]`) takes files dropped on it or chosen by browsing (a click, or Enter or Space on its focused input). It turns away files that don't match `accept`, are larger than `maxSize` or exceed `maxFiles`, and says why; `onReject` hears it too. Chosen files are listed with a remove button, and with a bar for those in `progress` (a `Map` of file to 0–1). The app does the upload; with `name`, a form posts the chosen files. Inside a `Field` it takes its id, label, description, error and invalid and disabled state from the Field. - Category: Data input - Import: `import { FileDropzone } from '@limerdev/zest'` - Exports: `FileDropzone` - Use for: Attaching receipts, invoices or images to a record; importing a CSV. - Don't: A single small file in a dense form: use `Input` with `type="file"`. Uploading inside the component: upload from `bind:files` in the app, and show it with `progress`. ```svelte Receipts Images or PDFs, up to 10 MB each. ``` Props of `FileDropzone`: - `accept` (`string`, default `undefined`): The file types it takes, as for an input: `image/*`, `.pdf`, `application/pdf`. - `files` (`File[]`, default `[]`, bindable): The chosen files, in the order they were added. Bindable. - `label` (`string`, default `the Config's `strings.dropFiles`, else 'Drop files here, or click to browse'`): The text in the drop area. - `locale` (`string`, default `the Config's `defaultLocale`, else the browser's`): The locale for file sizes (1,5 MB in `sv-SE`). - `maxFiles` (`number`, default `undefined`): How many files it holds at most; more are turned away. - `maxSize` (`number`, default `undefined`): The largest file it takes, in bytes. - `multiple` (`boolean`, default `false`): Takes several files. Without it a new file replaces the chosen one. - `onReject` (`((rejections: FileRejection[]) => void)`, default `undefined`): Called with the files turned away when files are added. - `progress` (`Map`, default `undefined`): Each file's upload progress, from 0 to 1, for files the app is uploading. A file without an entry shows no bar. - `rejectionMessage` (`((rejection: FileRejection, maxSize: string) => string)`, default `the Config's `strings.fileRejected`, else English messages: "report.exe isn't a type this takes."`): The message for a turned-away file, given the rejection and the largest size, formatted. - `removeLabel` (`((name: string) => string)`, default `the Config's `strings.removeFile`, else (name) => `Remove ${name}`): The remove button's accessible name, given the file's name. Example: Basic In a Field: images or PDFs up to 10 MB. Drop files on it, or click or press Enter to browse. ```svelte Receipts Images or PDFs, up to 10 MB each, five at most. ``` Example: Upload The app uploads: here a timer stands in for the request, and a SvelteMap of progress draws a bar per file. ```svelte
``` Example: States One CSV at a time (a new one replaces it), with its own label text; and disabled in its Field. ```svelte
Import Contract Locked once the invoice is sent.
``` ### Input A text input (`type` text, email, number, password, search, date, file …) with `bind:value`, or `bind:files` for `type="file"`. Inside a `Field` it takes its id, label, description, error and invalid and disabled state from the Field. - Category: Data input - Import: `import { Input } from '@limerdev/zest'` - Exports: `Input` - Use for: Single-line text and number entry, in a `Field`. - Don't: An Input without a label: wrap it in a `Field` with a `Field.Label`, or give it `aria-label`. `type="checkbox"` or `type="radio"`. Multi-line text. ```svelte Email ``` Props of `Input`: - `files` (`FileList | null`, bindable): The chosen files, for `type="file"`. Bindable. - `value` (`string | number | null`, bindable): The text, or a number for `type="number"`. Bindable. Example: Types Any text-like type. Outside a Field, name it with aria-label or a Label. ```svelte
``` Example: States aria-invalid marks an input invalid; inside a Field, a Field.Error does it for you. ```svelte
``` ### InputGroup A text field with addons inside its box: an icon, a unit or prefix, a button. `` holds one control, an `InputGroup.Input` or `InputGroup.Textarea` (in a `Field`, labelled and described by it), and `InputGroup.Addon`s (`align`: `inline-start`, `inline-end`, `block-start`, `block-end`) holding icons, `InputGroup.Text` or `InputGroup.Button`s. The group draws the box, its focus ring and its invalid state; clicking an addon's text focuses the control. - Category: Data input - Import: `import { InputGroup } from '@limerdev/zest'` - Exports: `InputGroup.Root`, `InputGroup.Addon`, `InputGroup.Text`, `InputGroup.Input`, `InputGroup.Textarea`, `InputGroup.Button` - Use for: A search field with an icon, an amount with its currency, a URL with its scheme, a secret with a copy or show button, a message box with a send button under it. - Don't: A plain input: use `Input`. A choice from a list: use `Select` or `Combobox`. An addon that is the only label: give the field a `Field.Label` or `aria-label`. ```svelte Amount kr ``` Props of `InputGroup.Addon`: - `align` (`"inline-start" | "inline-end" | "block-start" | "block-end"`, default `'inline-start'`): Where it sits: before or after the control on its line (`inline-start`, `inline-end`), or above or below it (`block-start`, `block-end`). Props of `InputGroup.Input`: - `files` (`FileList | null`, bindable): The chosen files, for `type="file"`. Bindable. - `value` (`string | number | null`, bindable): The text, or a number for `type="number"`. Bindable. Props of `InputGroup.Textarea`: - `value` (`string | null`, bindable): The text. Bindable. Props of `InputGroup.Button`: - `disabled` (`null | false | true`) - `href` (`string | null`) - `loading` (`boolean`, default `false`): Waiting for the action it started: a spinner shows (in place of the icon of an `icon`-size button), it is marked busy and unavailable, and clicks do nothing. Unlike `disabled`, it keeps keyboard focus. - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'sm'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `type` (`null | "button" | "submit" | "reset"`) - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'ghost'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Example: Addons An icon, a unit, a prefix: addons sit inside the field's box, before or after the input. ```svelte
Amount kr Website https://
``` Example: Buttons Buttons in addons: show a secret, or send a message from under its text area. ```svelte
API key (shown = !shown)} > {#if shown}{:else}{/if} Message Sent by email Send
``` ### Item A row of a list: `` (`variant`: `default`, `outline`, `muted`; `size`: `default`, `sm`) holds an `Item.Media` (an icon in a tile with `variant="icon"`, a cropped image with `variant="image"`), an `Item.Content` with an `Item.Title` and an `Item.Description`, and `Item.Actions`. `Item.Group` makes a list of items (each one a list item), with `Item.Separator`s between them. A row that opens something: in a group, put the link in its `Item.Title`, so the row stays a list item; a single row can be the link itself, with the root's `child` snippet. - Category: Data display - Import: `import { Item } from '@limerdev/zest'` - Exports: `Item.Root`, `Item.Group`, `Item.Separator`, `Item.Media`, `Item.Content`, `Item.Title`, `Item.Description`, `Item.Actions` - Use for: A list of people, files, integrations or notifications, each with a short description and an action; a settings row with a Switch. - Don't: Records compared across columns: use `Table`. A choice from a list: use `RadioGroup` or `Select`. A navigation menu: use `Sidebar` or `NavigationMenu`. ```svelte Invoice 1042 Nordlys AB, due 30 December. ``` Props of `Item.Root`: - `size` (`"default" | "sm"`, default `'default'`): The padding: `sm` for dense lists. - `variant` (`"outline" | "default" | "muted"`, default `'default'`): The look: `default` is plain, `outline` draws a border, `muted` fills it with the theme's surface. Props of `Item.Separator`: - `decorative` (`boolean`, default `true`): Whether the separator is decorative and should be hidden from assistive technologies. - `orientation` (`"horizontal" | "vertical"`, default `"horizontal"`): The orientation of the separator. Props of `Item.Media`: - `variant` (`"default" | "icon" | "image"`, default `'default'`): `icon` sets an icon in a small tile, `image` crops an image to a square; `default` shows the children as they are. Example: Basic A row: media, a title and description, and an action. ```svelte Invoice 1042 Nordlys AB, due 30 December. ``` Example: List Item.Group is a list; Item.Separator divides it. A link goes in the Item.Title, so each row stays a list item. ```svelte {#each people as person, index (person.id)} {#if index > 0}{/if} {person.initials}
{person.name} {person.email} {person.role} {/each} ``` Example: Link A single row that opens something is the link itself, with the child snippet. ```svelte {#snippet child({ props })} Security Two-factor sign-in and active sessions. {/snippet} ``` Example: Settings variant="muted" on a settings row, with a Switch labelled by the title. ```svelte Payment reminders Email the client when an invoice is a week overdue. ``` ### Kbd A key the user presses, as a small key cap: a `` element. One `Kbd` per key, side by side for a combination (`CtrlK`), or the whole combination in one (`⌘K`). It takes an icon (`` or a Lucide icon) for keys like Enter. - Category: Data display - Import: `import { Kbd } from '@limerdev/zest'` - Exports: `Kbd` - Use for: Keyboard shortcuts in help text, a tooltip or an empty state: "Press Ctrl K to search". - Don't: A shortcut beside a menu item: use the menu's `Shortcut`. Code or a value the user types: use ``. ```svelte

Press Ctrl K to search.

``` Example: Shortcuts One Kbd per key, side by side for a combination, or the combination in one. ```svelte

Press Ctrl K to search.

Press ⌘K on a Mac.

Press to send.

``` ### Label A label for a form control: clicking it focuses or toggles the control. - Category: Data input - Import: `import { Label } from '@limerdev/zest'` - Bits UI: `Label`, https://bits-ui.com/docs/components/label - Exports: `Label` - Use for: Naming a single control outside a `Field`, with `for` set to the control's `id`. - Don't: A form field with a description or an error: use `Field`, which wires the label, description and error to the control. Placeholder text instead of a label. ```svelte ``` Example: For a control A Label names the control its for points at. Inside a Field, use Field.Label. ```svelte
``` ### LinkPreview A preview card shown while the pointer rests on a link (`openDelay`, `closeDelay`): a person, a project or a document behind it. The link still works as a link. The card is a mouse convenience: keyboard and touch users only get the link. - Category: Overlays - Import: `import { LinkPreview } from '@limerdev/zest'` - Bits UI: `LinkPreview`, https://bits-ui.com/docs/components/link-preview - Exports: `LinkPreview.Root`, `LinkPreview.Trigger`, `LinkPreview.Content`, `LinkPreview.Portal` - Use for: A sighted, mouse-friendly preview of what a link leads to, such as a profile behind an @mention. - Don't: Anything the user needs, or anything to click inside the card: keyboard and touch users never see it. Use `Popover`, or put the information on the linked page. ```svelte @anna

Anna Berg

Project lead, Zest

``` Props of `LinkPreview.Root`: - `closeDelay` (`number`, default `300`): The delay in milliseconds before the preview closes. - `disabled` (`boolean`, default `false`): When `true`, the preview will be disabled and will not open. - `ignoreNonKeyboardFocus` (`boolean`, default `false`): Prevent the preview from opening if the focus did not come using the keyboard. - `onOpenChange` (`OnChangeFn`): A callback that will be called when the link preview is opened or closed. - `onOpenChangeComplete` (`OnChangeFn`): A callback that will be called when the link preview finishes opening/closing animations. - `open` (`boolean`, default `false`, bindable): The open state of the link preview. - `openDelay` (`number`, default `700`): The delay in milliseconds before the preview opens. Props of `LinkPreview.Content`: - `align` (`"start" | "center" | "end"`, default `'center'`): The preferred alignment of the anchor to render against when open. This may change when collisions occur. - `alignOffset` (`number`): An offset in pixels from the "start" or "end" alignment options. - `arrowPadding` (`number`): This describes the padding between the arrow and the edges of the floating element. If your floating element has border-radius, this will prevent it from overflowing the corners. - `avoidCollisions` (`boolean`, default `true`): When `true`, overrides the `side` and `align` options to prevent collisions with the boundary edges. - `collisionBoundary` (`Arrayable`): A boundary element or array of elements to check for collisions against. - `collisionPadding` (`number | Partial>`, default `8`): The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. - `customAnchor` (`string | HTMLElement | Measurable | null`): Use an element other than the trigger to anchor the content to. If provided, the content will be anchored to the provided element instead of the trigger. You can pass a selector string or an HTMLElement. - `dir` (`"ltr" | "rtl"`): The text direction of the content. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): When `true`, the link preview content will be forced to mount in the DOM. Useful for more control over the transition behavior. - `hideWhenDetached` (`boolean`) - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `portalProps` (`PortalProps`): Props for the portal the content renders in: `to` (the element to render in, the body by default) and `disabled` (render in place). - `side` (`"top" | "right" | "bottom" | "left"`, default `'bottom'`): The preferred side of the anchor to render against when open. Will be reversed when collisions occur. - `sideOffset` (`number`, default `4`): The distance in pixels from the anchor to the floating element. - `sticky` (`"partial" | "always"`) Props of `LinkPreview.Portal`: - `disabled` (`boolean`, default `false`): Disable portalling and render the component inline - `to` (`PortalTarget`, default `document.body`): Where to portal the content to. Example: A mention A profile behind an @mention. The link works as a link; the card is extra, for mouse users. ```svelte

Week 49 was approved by @anna AB Anna Berg Project lead, Zest. Approves hours for 12 people.

``` ### Menubar A bar of menus, as in a desktop application: `` holds a `Menubar.Menu` per menu, each with a `Menubar.Trigger` and a `Menubar.Content`. The contents take the same items as `DropdownMenu`: `Item` (`variant="error"`, `Shortcut`), `CheckboxItem`, `RadioGroup` with `RadioItem`s, `Group` with `GroupHeading`, `Label`, `Separator` and submenus. Left and Right move between menus, Down opens one, Escape closes. - Category: Navigation - Import: `import { Menubar } from '@limerdev/zest'` - Bits UI: `Menubar`, https://bits-ui.com/docs/components/menubar - Exports: `Menubar.Root`, `Menubar.Menu`, `Menubar.Trigger`, `Menubar.Content`, `Menubar.Portal`, `Menubar.Item`, `Menubar.CheckboxItem`, `Menubar.CheckboxGroup`, `Menubar.RadioGroup`, `Menubar.RadioItem`, `Menubar.Group`, `Menubar.GroupHeading`, `Menubar.Label`, `Menubar.Separator`, `Menubar.Shortcut`, `Menubar.Sub`, `Menubar.SubTrigger`, `Menubar.SubContent` - Use for: A dense editor or tool with many commands grouped into a few menus (File, Edit, View). - Don't: Site navigation: use links or `NavigationMenu`. A single menu: use `DropdownMenu`. ```svelte File New report ⌘N Export as CSV View Weekends ``` Props of `Menubar.Root`: - `dir` (`"ltr" | "rtl"`): The reading direction of the menubar. - `loop` (`boolean`): When `true`, the roving focus will loop back to the first menu item when the last menu item is reached and vice verse. - `onValueChange` (`OnChangeFn`): A callback that is called when the active menu changes. - `value` (`string`, default `''`, bindable): The 'value' assigned to the currently active menu in the menubar. Props of `Menubar.Menu`: - `onOpenChange` (`OnChangeFn`): A callback that is called when the menu is opened or closed. - `value` (`string`): The `value` assigned to the menu. Used to programmatically control the menu's open state within the menubar. Props of `Menubar.Trigger`: - `disabled` (`null | false | true`, default `false`): Whether the trigger for the menubar item is disabled. Props of `Menubar.Content`: - `align` (`"start" | "center" | "end"`, default `'start'`): The preferred alignment of the anchor to render against when open. This may change when collisions occur. - `alignOffset` (`number`, default `-4`): An offset in pixels from the "start" or "end" alignment options. - `arrowPadding` (`number`): This describes the padding between the arrow and the edges of the floating element. If your floating element has border-radius, this will prevent it from overflowing the corners. - `avoidCollisions` (`boolean`, default `true`): When `true`, overrides the `side` and `align` options to prevent collisions with the boundary edges. - `collisionBoundary` (`Arrayable`): A boundary element or array of elements to check for collisions against. - `collisionPadding` (`number | Partial>`, default `8`): The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. - `customAnchor` (`string | HTMLElement | Measurable | null`): Use an element other than the trigger to anchor the content to. If provided, the content will be anchored to the provided element instead of the trigger. You can pass a selector string or an HTMLElement. - `dir` (`"ltr" | "rtl"`): The text direction of the content. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): Whether to force mount the component. - `hideWhenDetached` (`boolean`) - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `loop` (`boolean`, default `false`): When `true`, the menu will loop through items when navigating with the keyboard. - `onCloseAutoFocus` (`EventCallback`): Event handler called when auto-focusing on close. Can be prevented. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `onOpenAutoFocus` (`EventCallback`): Event handler called when auto-focusing on open. Can be prevented. - `portalProps` (`PortalProps`): Props for the portal the content renders in: `to` (the element to render in, the body by default) and `disabled` (render in place). - `preventOverflowTextSelection` (`boolean`, default `true`): Passing `true` will prevent the overflow of text selection outside the element, provided the element is the top layer. - `preventScroll` (`boolean`, default `true`): Whether to prevent scrolling the body when the content is open. Whether to prevent body scrolling when the content is open. - `side` (`"top" | "right" | "bottom" | "left"`): The preferred side of the anchor to render against when open. Will be reversed when collisions occur. - `sideOffset` (`number`, default `6`): The distance in pixels from the anchor to the floating element. - `sticky` (`"partial" | "always"`) - `strategy` (`"absolute" | "fixed"`): The positioning strategy to use for the floating element. - `trapFocus` (`boolean`, default `false`): Whether focus is trapped within the focus scope. - `updatePositionStrategy` (`"always" | "optimized"`, default `"optimized"`): "optimized" will only update the position when necessary, while "always" will update the position on each animation frame, which is useful if the floating content is following something like a mouse cursor. Props of `Menubar.Portal`: - `disabled` (`boolean`, default `false`): Disable portalling and render the component inline - `to` (`PortalTarget`, default `document.body`): Where to portal the content to. Props of `Menubar.Item`: - `closeOnSelect` (`boolean`, default `true`): Whether or not the menu item should close when selected. - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. - `variant` (`"error" | "default"`, default `'default'`): `error` colours the item for deleting. Props of `Menubar.CheckboxItem`: - `checked` (`boolean`, default `false`, bindable): The checked state of the checkbox. It can be one of: - `true` for checked - `false` for unchecked - `closeOnSelect` (`boolean`, default `false`): Whether or not the menu item should close when selected. - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `indeterminate` (`boolean`, default `false`, bindable): Whether the checkbox is in an indeterminate state or not. - `onCheckedChange` (`OnChangeFn`): A callback that is fired when the checked state changes. - `onIndeterminateChange` (`OnChangeFn`): A callback function called when the indeterminate state changes. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. - `value` (`string`): The value of the checkbox item when used in a checkbox group. Props of `Menubar.CheckboxGroup`: - `onValueChange` (`OnChangeFn`): A callback that is fired when the selected checkbox items change. - `value` (`string[]`, default `[]`, bindable): The values of the selected checkbox items. Supports two-way binding with `bind:value`. Props of `Menubar.RadioGroup`: - `onValueChange` (`OnChangeFn`): A callback that is fired when the selected radio item changes. - `value` (`string`, default `''`, bindable): The value of the selected radio item. Supports two-way binding with `bind:value`. Props of `Menubar.RadioItem`: - `closeOnSelect` (`boolean`, default `false`): Whether or not the menu item should close when selected. - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. - `value` (`string`, required): The value of the radio item. Props of `Menubar.GroupHeading`: - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. Props of `Menubar.Label`: - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. Props of `Menubar.Sub`: - `onOpenChange` (`OnChangeFn`): A callback that is called when the menu is opened or closed. - `onOpenChangeComplete` (`OnChangeFn`): A callback that is called when the menu finishes opening/closing animations. - `open` (`boolean`, default `false`, bindable): The open state of the menu. Props of `Menubar.SubTrigger`: - `disabled` (`boolean`, default `false`): When `true`, the user will not be able to interact with the menu item. - `inset` (`boolean`): Indent the text to line up with items that show an icon, check or dot. - `onSelect` (`((event: Event) => void)`): A callback fired when the menu item is selected. Prevent default behavior of selection with `event.preventDefault()`. - `openDelay` (`number`, default `100`): The amount of time in ms from when the mouse enters the subtrigger until the submenu opens. This is useful for preventing the submenu from opening as a user is moving their mouse through the menu without a true intention to open that submenu. To disable the behavior, set it to `0`. - `textValue` (`string`, default `undefined`): Optional text to use for typeahead filtering. By default, typeahead will use the `.textContent` of the menu item. When the content is more complex, you can provide a string here instead. Props of `Menubar.SubContent`: - `align` (`"start" | "center" | "end"`): The preferred alignment of the anchor to render against when open. This may change when collisions occur. - `alignOffset` (`number`): An offset in pixels from the "start" or "end" alignment options. - `arrowPadding` (`number`): This describes the padding between the arrow and the edges of the floating element. If your floating element has border-radius, this will prevent it from overflowing the corners. - `avoidCollisions` (`boolean`, default `true`): When `true`, overrides the `side` and `align` options to prevent collisions with the boundary edges. - `collisionBoundary` (`Arrayable`): A boundary element or array of elements to check for collisions against. - `collisionPadding` (`number | Partial>`, default `8`): The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. - `customAnchor` (`string | HTMLElement | Measurable | null`): Use an element other than the trigger to anchor the content to. If provided, the content will be anchored to the provided element instead of the trigger. You can pass a selector string or an HTMLElement. - `dir` (`"ltr" | "rtl"`): The text direction of the content. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): Whether to force mount the component. - `hideWhenDetached` (`boolean`) - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `loop` (`boolean`, default `false`): When `true`, the menu will loop through items when navigating with the keyboard. - `onCloseAutoFocus` (`EventCallback`): Event handler called when auto-focusing on close. Can be prevented. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `onOpenAutoFocus` (`EventCallback`): Event handler called when auto-focusing on open. Can be prevented. - `preventOverflowTextSelection` (`boolean`, default `true`): Passing `true` will prevent the overflow of text selection outside the element, provided the element is the top layer. - `side` (`"top" | "right" | "bottom" | "left"`): The preferred side of the anchor to render against when open. Will be reversed when collisions occur. - `sideOffset` (`number`): The distance in pixels from the anchor to the floating element. - `sticky` (`"partial" | "always"`) - `strategy` (`"absolute" | "fixed"`): The positioning strategy to use for the floating element. - `trapFocus` (`boolean`, default `false`): Whether focus is trapped within the focus scope. - `updatePositionStrategy` (`"always" | "optimized"`, default `"optimized"`): "optimized" will only update the position when necessary, while "always" will update the position on each animation frame, which is useful if the floating content is following something like a mouse cursor. Example: Basic A report editor's commands. Left and Right move between menus. ```svelte File New report ⌘N Duplicate Export As CSV As PDF View Show weekends Group by Project Person Help Keyboard shortcuts ``` ### Meter A measurement within a known range: `value` between `min` and `max` (0 and 100 by default), announced as a meter. Name it with `aria-label` or `aria-labelledby`, and set `aria-valuetext` when the number alone doesn't say it ("312 of 400 hours"). - Category: Data display - Import: `import { Meter } from '@limerdev/zest'` - Bits UI: `Meter`, https://bits-ui.com/docs/components/meter - Exports: `Meter` - Use for: Hours used of a budget, storage used, a score. - Don't: How far a running task has come: use `Progress`. ```svelte ``` Props of `Meter`: - `max` (`number`, default `100`): The maximum value of the meter. - `min` (`number`, default `0`): The minimum value of the meter. - `value` (`number`, default `0`): The current value of the meter. Example: Basic aria-valuetext says what the number means. A class can recolour the indicator. ```svelte

Budget used 312 of 400 h

Support hours 58 of 60 h

``` ### NativeSelect The browser's own `` element. Bind to call `focus()`, read selection, etc. - `maxlength` (`number`, required): The max length of the input. - `onComplete` (`((...args: any[]) => void)`): A callback function that is called when the input is completely filled. - `onValueChange` (`OnChangeFn`): A callback function that is called when the value of the input changes. - `pasteTransformer` (`((text: string) => string)`): A callback function that is called when the user pastes text into the input. It receives the pasted text as an argument, and should return the sanitized text. Use this function to clean up the pasted text, like removing hyphens or other characters that should not make it into the input. - `pushPasswordManagerStrategy` (`"none" | "increase-width"`): How to handle the input when a password manager is detected. - `textalign` (`"right" | "left" | "center"`, default `"left"`): Customize the alignment of the text within in the input. - `value` (`string`, default `''`, bindable): The value of the input. Props of `PinInput.Cell`: - `cell` (`PinInputCell`, required): This specific cell, which is provided by the `cells` snippet prop from the `PinInput.Root` component. Example: Basic Six boxes. Pasting a code fills them all. ```svelte Verification code Sent to your phone. {code.length}/6 ``` Example: Groups The children snippet gets the cells, to split them into groups with a separator. ```svelte Recovery code {#snippet children({ cells })} {#each cells.slice(0, 3) as cell, index (index)} {/each} {#each cells.slice(3) as cell, index (index)} {/each} {/snippet} ``` ### Popover A panel of extra content or controls anchored to a trigger. Click or Enter opens it, Escape or a click outside closes it, and focus returns to the trigger. `Popover.Header`, `Popover.Title` and `Popover.Description` lay out its text. - Category: Overlays - Import: `import { Popover } from '@limerdev/zest'` - Bits UI: `Popover`, https://bits-ui.com/docs/components/popover - Exports: `Popover.Root`, `Popover.Trigger`, `Popover.Close`, `Popover.Portal`, `Popover.Content`, `Popover.Header`, `Popover.Title`, `Popover.Description` - Use for: Short, interactive content tied to one control: a filter form, a share link, quick settings, details behind an info button. - Don't: Content the user must deal with before going on: use `Dialog`. A plain hint on hover: use `Tooltip`. A list of actions: use `DropdownMenu`. ```svelte Share Share this report Anyone with the link can view it. ``` Props of `Popover.Root`: - `onOpenChange` (`OnChangeFn`): A callback that is called when the popover's open state changes. - `onOpenChangeComplete` (`OnChangeFn`): A callback that is called when the popover's open state changes and the animation is complete. - `open` (`boolean`, default `false`, bindable): The open state of the popover. Props of `Popover.Trigger`: - `closeDelay` (`number`, default `300`): How long to wait before closing the popover after hover ends (ms). Only applies when `openOnHover` is `true`. - `openDelay` (`number`, default `700`): How long to wait before opening the popover on hover (ms). Only applies when `openOnHover` is `true`. - `openOnHover` (`boolean`, default `false`): Whether the popover should open when the trigger is hovered. - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Props of `Popover.Close`: - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Props of `Popover.Portal`: - `disabled` (`boolean`, default `false`): Disable portalling and render the component inline - `to` (`PortalTarget`, default `document.body`): Where to portal the content to. Props of `Popover.Content`: - `align` (`"start" | "center" | "end"`, default `'center'`): The preferred alignment of the anchor to render against when open. This may change when collisions occur. - `alignOffset` (`number`): An offset in pixels from the "start" or "end" alignment options. - `arrowPadding` (`number`): This describes the padding between the arrow and the edges of the floating element. If your floating element has border-radius, this will prevent it from overflowing the corners. - `avoidCollisions` (`boolean`, default `true`): When `true`, overrides the `side` and `align` options to prevent collisions with the boundary edges. - `collisionBoundary` (`Arrayable`): A boundary element or array of elements to check for collisions against. - `collisionPadding` (`number | Partial>`, default `8`): The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. - `customAnchor` (`string | HTMLElement | Measurable | null`): Use an element other than the trigger to anchor the content to. If provided, the content will be anchored to the provided element instead of the trigger. You can pass a selector string or an HTMLElement. - `dir` (`"ltr" | "rtl"`): The text direction of the content. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): Whether to force mount the component. - `hideWhenDetached` (`boolean`) - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `onCloseAutoFocus` (`EventCallback`): Event handler called when auto-focusing on close. Can be prevented. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `onOpenAutoFocus` (`EventCallback`): Event handler called when auto-focusing on open. Can be prevented. - `portalProps` (`PortalProps`): Props for the portal the content renders in: `to` (the element to render in, the body by default) and `disabled` (render in place). - `preventOverflowTextSelection` (`boolean`, default `true`): Passing `true` will prevent the overflow of text selection outside the element, provided the element is the top layer. - `preventScroll` (`boolean`, default `true`): Whether to prevent scrolling the body when the content is open. Whether to prevent body scrolling when the content is open. - `side` (`"top" | "right" | "bottom" | "left"`): The preferred side of the anchor to render against when open. Will be reversed when collisions occur. - `sideOffset` (`number`, default `4`): The distance in pixels from the anchor to the floating element. - `sticky` (`"partial" | "always"`) - `strategy` (`"absolute" | "fixed"`): The positioning strategy to use for the floating element. - `trapFocus` (`boolean`, default `false`): Whether focus is trapped within the focus scope. - `updatePositionStrategy` (`"always" | "optimized"`, default `"optimized"`): "optimized" will only update the position when necessary, while "always" will update the position on each animation frame, which is useful if the floating content is following something like a mouse cursor. Example: Basic A panel anchored to its trigger: Escape or a click outside closes it. ```svelte Share Share this report Anyone with the link can view it. Link ``` Example: Sides side and align place the panel; it flips to the other side when there is no room. ```svelte {#each sides as side (side)} {side} Opens on the {side}. {/each} ``` Example: A filter form A small form in a popover, closed from code once applied. ```svelte Filters Show projects Billable only Include archived ``` ### Progress A bar showing how far a task has come: `value` out of `max` (100 by default), announced as a progressbar. With no `value` (or `null`) it shows that the task is running without knowing how far. Name it with `aria-label` or `aria-labelledby`. - Category: Feedback - Import: `import { Progress } from '@limerdev/zest'` - Bits UI: `Progress`, https://bits-ui.com/docs/components/progress - Exports: `Progress` - Use for: An upload, an import or an export the user waits for. - Don't: A measurement within a range, such as hours used of a budget or a score: use `Meter`. A long wait without a label saying what is happening. ```svelte ``` Props of `Progress`: - `max` (`number`, default `100`): The maximum value of the progress bar. - `min` (`number`, default `0`): The minimum value of the progress bar. - `value` (`number | null`, default `0`): The current value of the progress bar. If `null`, the progress bar will be in an indeterminate state. Example: Basic A label says what is happening; without a value the bar shows work in progress. ```svelte

Importing hours · {value}%

Syncing with the API

``` ### RadioGroup A set of radio buttons with `bind:value`: `` holds one `RadioGroup.Item` per option. Tab enters the group, arrow keys move and select. Put each item in a `Field orientation="horizontal"` with a `Field.Label`, and the group in a `Field.Set` with a `Field.Legend` that names it. - Category: Data input - Import: `import { RadioGroup } from '@limerdev/zest'` - Bits UI: `RadioGroup`, https://bits-ui.com/docs/components/radio-group - Exports: `RadioGroup.Root`, `RadioGroup.Item` - Use for: Choosing exactly one of a few options (up to about six) that should all be visible. - Don't: Many options, or options that don't fit on screen: use `Select`. Independent on/off choices: use `Checkbox`. A group without a `Field.Legend` (or `aria-label`). ```svelte Billing Monthly Yearly ``` Props of `RadioGroup.Root`: - `autocomplete` (`FullAutoFill | null`, default `"off"`): The `autocomplete` attribute to forward to the hidden input element. Browsers can otherwise autofill the hidden input with values that don't match any of the radio items. - `disabled` (`boolean`, default `false`): Whether the radio group is disabled. - `loop` (`boolean`, default `true`): Whether to loop around the radio items when navigating with the keyboard. - `name` (`string`, default `undefined`): The name to apply to the radio group's input element for form submission. If not provided, a hidden input will not be rendered and the radio group will not be part of a form. - `onValueChange` (`OnChangeFn`): The callback to call when the selected radio item changes. - `orientation` (`"horizontal" | "vertical"`, default `"vertical"`): The orientation of the radio group. Used to determine how keyboard navigation should work. - `readonly` (`boolean`, default `false`): Whether the radio group is readonly. When readonly, users can focus and navigate through items but cannot change the value. - `required` (`boolean`): Whether the radio group is required for form submission. If `true`, ensure you provide a `name` prop so the hidden input is rendered. - `value` (`string`, default `''`, bindable): The value of the selected radio item. Props of `RadioGroup.Item`: - `disabled` (`null | false | true`, default `false`): Whether the radio item is disabled. - `value` (`string`, required): The value of the radio item. Example: Basic One Field per option; the Field.Legend names the group. Arrow keys move and select. ```svelte Billing Monthly Yearly ``` Example: With descriptions Field.Content puts a description under each option's label. ```svelte Pricing {#each plans as option (option.value)} {option.label} {option.description} {/each} ``` ### RangeCalendar A month calendar to pick a range of dates: `bind:value` is `{ start, end }` of `DateValue`s (from `@limerdev/zest`). The first click sets the start, the second the end; the days between are highlighted. `minDays`, `maxDays`, `minValue`, `maxValue`, `isDateUnavailable`, `numberOfMonths`. With no children it draws the header and month grids; its parts are named like `Calendar`'s for custom layouts. - Category: Data input - Import: `import { RangeCalendar } from '@limerdev/zest'` - Bits UI: `RangeCalendar`, https://bits-ui.com/docs/components/range-calendar - Exports: `RangeCalendar.Root`, `RangeCalendar.Header`, `RangeCalendar.Heading`, `RangeCalendar.PrevButton`, `RangeCalendar.NextButton`, `RangeCalendar.Months`, `RangeCalendar.Grid`, `RangeCalendar.GridHead`, `RangeCalendar.GridBody`, `RangeCalendar.GridRow`, `RangeCalendar.HeadCell`, `RangeCalendar.Cell`, `RangeCalendar.Day` - Use for: Picking a period: a report's date range, an absence, a project phase. In a form, `DateRangePicker` puts it in a popover. - Don't: A single date: use `Calendar`. Dates people type: use `DateRangeField`. ```svelte ``` Props of `RangeCalendar.Root`: - `calendarLabel` (`string`): This label is exclusively used for accessibility, remaining hidden from the page. It's read by screen readers when the calendar is opened. The current month and year are automatically appended to the label, so you only need to provide the base label. For instance: - 'Date of birth' will be read as 'Date of birth, January 2021' if the current month is January 2021. - 'Appointment date' will be read as 'Appointment date, January 2021' if the current month is January 2021. - 'Booking date' will be read as 'Booking date, January 2021' if the current month is January 2021. - `disabled` (`boolean`, default `false`): Whether or not the calendar is disabled. - `disableDaysOutsideMonth` (`boolean`, default `false`): Whether to disable the selection of days outside the current month. By default, days outside the current month are rendered to fill the calendar grid, but they are not selectable. Setting this prop to `true` will disable this behavior. - `excludeDisabled` (`boolean`, default `false`): Whether to automatically reset the range if any date within the selected range becomes disabled. When true, the entire range will be cleared if a disabled date is found between the start and end dates. - `fixedWeeks` (`boolean`, default `false`): Display 6 weeks per month, regardless the month's number of weeks. This is useful for displaying a consistent calendar, where the size of the calendar doesn't change month to month. To display 6 weeks per month, you will need to render out the previous and next month's dates in the calendar as well. - `isDateDisabled` (`DateMatcher`): A function that receives a date and returns `true` or `false` to indicate whether the date is disabled. - `isDateUnavailable` (`DateMatcher`): Dates matching the provided matchers are marked as "unavailable." Unlike disabled dates, users can still focus and select unavailable dates. However, selecting an unavailable date renders the date picker as invalid. For example, in a calendar for booking appointments, you might mark already booked dates as unavailable. These dates could become available again before the appointment date, allowing users to select them to learn more about the appointment. `[data-unavailable]` - applied to unavailable dates - `locale` (`string`, default `'en'`): The default locale setting. - `maxDays` (`number`, default `undefined`): The maximum number of days that can be selected in a range. - `maxValue` (`DateValue`): The maximum date that can be selected in the calendar. - `minDays` (`number`, default `undefined`): The minimum number of days that can be selected in a range. - `minValue` (`DateValue`): The minimum date that can be selected in the calendar. - `monthFormat` (`"numeric" | "long" | "short" | "narrow" | "2-digit" | ((month: number) => string)`, default `"long"`): The format of the month names in the calendar. - `numberOfMonths` (`number`, default `1`): Determines the number of months to display on the calendar simultaneously. For navigation between months, refer to the `pagedNavigation` prop. - `onEndValueChange` (`OnChangeFn`): A callback function called when the end value changes. This doesn't necessarily mean the `value` has updated and should be used to apply cosmetic changes to the calendar when only part of the value is changed/completed. - `onPlaceholderChange` (`OnChangeFn`): A callback function called when the placeholder value changes. - `onStartValueChange` (`OnChangeFn`): A callback function called when the start value changes. This doesn't necessarily mean the `value` has updated and should be used to apply cosmetic changes to the calendar when only part of the value is changed/completed. - `onValueChange` (`OnChangeFn`): A callback function called when the value changes. - `pagedNavigation` (`boolean`, default `false`): Applicable only when `numberOfMonths` is greater than 1. Controls whether to use paged navigation for the next and previous buttons in the date picker. With paged navigation set to `true`, clicking the next/prev buttons changes all months in view. When set to `false`, it shifts the view by a single month. For example, with `pagedNavigation` set to `true` and 2 months displayed (January and February), clicking the next button changes the view to March and April. If `pagedNavigation` is `false`, the view shifts to February and March. - `placeholder` (`DateValue`, default `the current date`, bindable): The placeholder date, used to control the view of the calendar when no value is present. - `preventDeselect` (`boolean`, default `false`): Whether or not users can deselect a date once selected without selecting another date. - `readonly` (`boolean`, default `false`): Whether the calendar is readonly. When true, the user will be able to focus and navigate the calendar, but will not be able to select dates. - `value` (`DateRange`, bindable): The value of the selected date range. - `weekdayFormat` (`"long" | "short" | "narrow"`, default `'short'`): How the string representation of the weekdays provided via the `weekdays` state store should be formatted. ```md - "long": "Sunday", "Monday", "Tuesday", etc. - "short": "Sun", "Mon", "Tue", etc. - "narrow": "S", "M", "T", etc. ``` - `weekStartsOn` (`0 | 1 | 2 | 3 | 4 | 5 | 6`, default `0 (Sunday)`): The day of the week to start the calendar on, which must be a number between 0 and 6, where 0 is Sunday and 6 is Saturday. - `yearFormat` (`"numeric" | "2-digit" | ((year: number) => string)`, default `"numeric"`): The format of the year names in the calendar. Props of `RangeCalendar.Cell`: - `date` (`DateValue`, required): The date value of the cell. - `month` (`DateValue`, required): The month DateValue that this cell is being rendered in. Example: Basic Click the first and last day of the period. ```svelte

{period.start?.toString() ?? '…'} – {period.end?.toString() ?? '…'}

``` ### RatingGroup A rating out of `max` stars (5 by default), announced as a slider: `` (`bind:value`, `allowHalf`, `readonly`, `name`) draws its stars when it has no children; for custom ones, render `RatingGroup.Item`s (`index`) from the `children` snippet's `items`; each item's own `children` snippet gets its `state`. Arrow keys change the rating, Home and End go to the ends. Inside a `Field` it is named by `Field.Label`; outside one, give it `aria-label`. - Category: Data input - Import: `import { RatingGroup } from '@limerdev/zest'` - Bits UI: `RatingGroup`, https://bits-ui.com/docs/components/rating-group - Exports: `RatingGroup.Root`, `RatingGroup.Item` - Use for: Rating something: feedback on a delivery, how a sprint went. - Don't: A choice between named options: use `RadioGroup`. Showing an average read-only without the number: show the number too. ```svelte How did the sprint go? ``` Props of `RatingGroup.Root`: - `allowHalf` (`boolean`, default `false`): Whether to allow half-star ratings. - `aria-valuetext` (`RatingGroupAriaValuetext`, default `((value: number, max: number) => `${value} out of ${max}`)`): An extended `aria-valuetext` property to use for the rating group. Can either be a string, or a function that receives the current value and max value and returns a string. - `disabled` (`boolean`, default `false`): Whether the rating group is disabled. - `hoverPreview` (`boolean`, default `true`): Whether to show a preview when hovering over rating items. Touch events are ignored to prevent accidental previews. - `max` (`number`, default `5`): The maximum rating value (number of items). - `min` (`number`, default `0`): The minimum rating value. - `name` (`string`, default `undefined`): The name to apply to the rating group's input element for form submission. If not provided, a hidden input will not be rendered and the rating group will not be part of a form. - `onValueChange` (`OnChangeFn`): The callback to call when the rating value changes. - `orientation` (`"horizontal" | "vertical"`, default `"horizontal"`): The orientation of the rating group. Used to determine how keyboard interactions work. - `readonly` (`boolean`, default `false`): Whether the rating group is readonly. - `required` (`boolean`, default `false`): Whether the rating group is required for form submission. If `true`, ensure you provide a `name` prop so the hidden input is rendered. - `value` (`number`, default `0`, bindable): The current rating value. Props of `RatingGroup.Item`: - `disabled` (`null | false | true`, default `false`): Whether the rating item is disabled. - `index` (`number`, required): The index of the rating item (0-based index). Example: Basic In a Field the label names the rating. allowHalf allows half stars; readonly shows a rating that can't change. ```svelte
How did the sprint go? {rating} of 5 Average this quarter 3.5 of 5
``` ### ScrollArea A scrollable box with slim scrollbars that match the theme: give it a height (or width) and `orientation` (`vertical`, `horizontal`, `both`). It scrolls with the wheel, touch and keyboard like any scrolling box. `ScrollArea.Scrollbar` is there for custom layouts. - Category: Layout - Import: `import { ScrollArea } from '@limerdev/zest'` - Bits UI: `ScrollArea`, https://bits-ui.com/docs/components/scroll-area - Exports: `ScrollArea.Root`, `ScrollArea.Scrollbar` - Use for: A long list inside a fixed panel: a sidebar's projects, a dialog's terms, a wide table in a card. - Don't: The page's own scrolling: let the window scroll. Content that fits: no scroll box. ```svelte {#each projects as project (project.id)}

{project.name}

{/each}
``` Props of `ScrollArea.Root`: - `dir` (`"ltr" | "rtl"`): The reading direction of the application. - `orientation` (`"both" | "horizontal" | "vertical"`, default `'vertical'`): Which scrollbars to draw: `vertical`, `horizontal` or `both`. - `scrollbarXClasses` (`string`, default `''`): Classes for the horizontal scrollbar. - `scrollbarYClasses` (`string`, default `''`): Classes for the vertical scrollbar. - `scrollHideDelay` (`number`, default `600`): The amount of time in milliseconds to delay before hiding the scrollbars after leaving the scroll area or stopping scrolling. - `type` (`"auto" | "always" | "hover" | "scroll"`, default `"hover"`): The type of scroll area to render. - `viewportRef` (`HTMLElement | null`, default `null`, bindable): The scrolling viewport element. Bindable. Props of `ScrollArea.Scrollbar`: - `forceMount` (`boolean`): Whether to forcefully mount the component. Useful when working with external animation/transition libraries. - `orientation` (`"horizontal" | "vertical"`, default `'vertical'`, required) Example: A list A fixed-height list with a slim scrollbar. ```svelte

Projects

{#each projects as project, index (project)} {#if index > 0} {/if}

{project}

{/each}
``` Example: Horizontal orientation="horizontal" scrolls a row sideways. ```svelte
{#each weeks as week (week)}
Week {week}
{/each}
``` ### Select A choice from a list: `` (`type="single"` or `"multiple"`, `bind:value`, `name` for forms, `items`) holds a `Select.Trigger` (`placeholder`) and a `Select.Content`. Given `items`, the parts need no children: the trigger shows the chosen label and the content draws an item for each. For custom markup, give the trigger a `Select.Value` and the content `Select.Item`s. Items can be grouped (`Select.Group` with `Select.GroupHeading`) and divided (`Select.Separator`). Arrow keys move, Enter chooses, typing jumps to a match. Inside a `Field` the trigger is labelled, described and marked invalid by the Field. - Category: Data input - Import: `import { Select } from '@limerdev/zest'` - Bits UI: `Select`, https://bits-ui.com/docs/components/select - Exports: `Select.Root`, `Select.Group`, `Select.Label`, `Select.Item`, `Select.Content`, `Select.Trigger`, `Select.Separator`, `Select.ScrollDownButton`, `Select.ScrollUpButton`, `Select.GroupHeading`, `Select.Portal`, `Select.Value` - Use for: Choosing one (or a few) of a known list of options, more than a `RadioGroup` shows comfortably: a status, a country, a project. - Don't: Long lists people search in, or values they type: use `Combobox`. Two to five options that fit on screen: use `RadioGroup`. Actions rather than a value: use `DropdownMenu`. ```svelte Status ``` Props of `Select.Root`: - `allowDeselect` (`boolean`): Whether to allow the user to deselect an item by clicking on an already selected item. This is only applicable to `type="single"` selects/comboboxes. - `autocomplete` (`FullAutoFill | null`): The autocomplete attribute to forward to the hidden input element. - `disabled` (`boolean`, default `false`): Whether the combobox is disabled. - `items` (`{ value: string; label: string; disabled?: boolean | undefined; }[]`): Optionally provide an array of `value` and `label` pairs that will be used to match and trigger selection when the trigger is focused and a key is pressed while the content is closed. It's also used to handle form autofill. By providing this value, you enable selecting a value when the trigger is focused and a key is pressed without the content being open, similar to how a native ` Cancel ``` Props of `Sheet.Root`: - `onOpenChange` (`OnChangeFn`): A callback that is called when the popover's open state changes. - `onOpenChangeComplete` (`OnChangeFn`): A callback called when the dialog finishes opening/closing animations. - `open` (`boolean`, default `false`, bindable): The open state of the dialog. Props of `Sheet.Trigger`: - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Props of `Sheet.Close`: - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'default'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'primary'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Props of `Sheet.Portal`: - `disabled` (`boolean`, default `false`): Disable portalling and render the component inline - `to` (`PortalTarget`, default `document.body`): Where to portal the content to. Props of `Sheet.Overlay`: - `forceMount` (`boolean`): Whether to force mount the component. Props of `Sheet.Content`: - `closeLabel` (`string`, default `the Config's `strings.close`, else 'Close'`): The close button's name for screen readers. - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Escape behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press. - `forceMount` (`boolean`): Whether to force mount the component. - `interactOutsideBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`, default `close`): Interact outside behavior type. `close`: Closes the element immediately. `defer-otherwise-close`: Delegates the action to the parent element. If no parent is found, it closes the element. `defer-otherwise-ignore`: Delegates the action to the parent element. If no parent is found, nothing is done. `ignore`: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction. - `onCloseAutoFocus` (`EventCallback`): Event handler called when auto-focusing on close. Can be prevented. - `onEscapeKeydown` (`((e: KeyboardEvent) => void)`): Callback fired when escape is pressed. - `onFocusOutside` (`((event: FocusEvent) => void)`): Callback fired when focus leaves the dismissible layer. - `onInteractOutside` (`InteractOutsideEventHandler`): Callback fired when an outside interaction event completes, which is either a `pointerup`, `mouseup`, or `touchend` event, depending on the user's input device. - `onOpenAutoFocus` (`EventCallback`): Event handler called when auto-focusing on open. Can be prevented. - `portalProps` (`PortalProps`): Props for the portal the content renders in: `to` (the element to render in, the body by default) and `disabled` (render in place). - `preventBodyPointerEvents` (`boolean`, default `true`): Whether to set `pointer-events: none` on the `` while the dialog is open. When `false` and a `Dialog.Overlay` is rendered, the overlay blocks pointer interaction with the page instead, which avoids restyling every element on the page when the dialog opens and closes. Without an overlay, the body is still blocked. Elements stacked above the overlay that aren't part of the dialog (toasts, a header with a higher `z-index`) receive pointer events when this is `false`. - `preventOverflowTextSelection` (`boolean`, default `true`): Passing `true` will prevent the overflow of text selection outside the element, provided the element is the top layer. - `preventScroll` (`boolean`, default `true`): Whether to prevent body scrolling when the content is open. - `restoreScrollDelay` (`number | null`, default `null`): The delay in milliseconds before the scrollbar is restored after closing the dialog. This is only applicable when using the `child` snippet for custom transitions and `preventScroll` is `true`. You should set this to a value greater than the transition duration to prevent content from shifting during the transition. - `showCloseButton` (`boolean`, default `true`): Show a close button in the corner. - `side` (`"top" | "right" | "bottom" | "left"`, default `'right'`): The edge of the screen the sheet slides in from. - `trapFocus` (`boolean`, default `false`): Whether focus is trapped within the focus scope. Props of `Sheet.Title`: - `level` (`1 | 2 | 3 | 4 | 5 | 6`): The heading level of the dialog title. Example: Edit form A form beside the page: a header, the fields, and a footer of actions. ```svelte Edit customer Edit customer Changes apply to new invoices.
Name Email
Cancel
``` Example: Sides side: the edge it slides in from. ```svelte
{#each sides as side (side)} {side} From the {side} Escape, the overlay or the close button closes it. {/each}
``` ### Sidebar An app's layout with a navigation panel: `` (`bind:open`, `collapsible`: `offcanvas` by default, `icon` or `none`) holds a `Sidebar.Panel` and a `Sidebar.Inset` (the page, `main`), where a `Sidebar.Trigger` shows and hides the panel. The panel has a `Sidebar.Header`, a `Sidebar.Content` (a navigation landmark, `label`) of `Sidebar.Group`s, each named by a `Sidebar.GroupLabel` and holding a `Sidebar.Menu` of `Sidebar.MenuItem`s, and a `Sidebar.Footer`. A `Sidebar.MenuButton` is a link with `href` (a button without); `active` marks the current page, which the app passes from its router; its text goes in a ``, hidden but still read when the panel collapses to icons; a `Sidebar.MenuBadge` shows a count. Below the `md` breakpoint the panel is a sheet from the left (`bind:openMobile`) that closes when a page is chosen. - Category: Layout - Import: `import { Sidebar } from '@limerdev/zest'` - Exports: `Sidebar.Root`, `Sidebar.Panel`, `Sidebar.Header`, `Sidebar.Content`, `Sidebar.Footer`, `Sidebar.Group`, `Sidebar.GroupLabel`, `Sidebar.Menu`, `Sidebar.MenuItem`, `Sidebar.MenuButton`, `Sidebar.MenuBadge`, `Sidebar.Trigger`, `Sidebar.Inset` - Use for: The frame of an admin app: its sections and pages, the workspace and the user. - Don't: A few pages: links in a header (`NavigationMenu`). Tabs within one page: use `Tabs`. A panel of details or a form: use `Sheet`. ```svelte Acme Billing Billing 12
{@render children()}
``` Props of `Sidebar.Root`: - `collapsible` (`"none" | "icon" | "offcanvas"`, default `'offcanvas'`): How the panel collapses on a wide screen: off the screen (`offcanvas`), to its icons (`icon`), or not at all (`none`). - `open` (`boolean`, default `true`, bindable): Whether the panel is expanded on a wide screen. - `openMobile` (`boolean`, default `false`, bindable): Whether the panel's sheet is open on a small screen. Props of `Sidebar.Panel`: - `label` (`string`, default `the Config's `strings.sidebar`, else 'Sidebar'`): The name of the panel's sheet on a small screen. Props of `Sidebar.Content`: - `label` (`string`, default `the Config's `strings.mainNavigation`, else 'Main'`): The name of the navigation landmark. Props of `Sidebar.MenuButton`: - `active` (`boolean`, default `false`): Marks the current page: `aria-current="page"` and the active look. The app knows its route and passes it. Props of `Sidebar.Trigger`: - `label` (`string`, default `the Config's `strings.toggleSidebar`, else 'Toggle sidebar'`): The button's name for screen readers. - `size` (`"default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`, default `'icon-sm'`): The height and padding, from the theme's field size; the `icon` sizes are square. - `variant` (`"link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost"`, default `'ghost'`): The look, by the theme's colour roles: `primary` for the main action, `error` for deleting, `secondary`, `neutral` and `outline` for the rest, `ghost` in toolbars, `link` for a navigation that looks like text. Example: App frame An app frame that collapses to icons. In an app it fills the screen; here it is sized to fit the preview. active comes from the app's router. ```svelte
Acme Billing {#each sections as section (section.label)} {section.label} {#each section.pages as item (item.href)} { event.preventDefault(); current = item.href; }} > {#if item.count} {item.count} {/if} {/each} {/each}
{sections.flatMap((section) => section.pages).find((p) => p.href === current)?.label}
The page.
``` ### Skeleton A placeholder shaped like content that is loading: `` is a pulsing block, sized and shaped with classes (`h-4 w-40`, `size-10 rounded-full`). It is hidden from assistive technology: mark the region that is loading `aria-busy="true"`, and give it a name or a status text. The pulse stops with reduced motion. - Category: Feedback - Import: `import { Skeleton } from '@limerdev/zest'` - Exports: `Skeleton` - Use for: The first load of a page or card whose layout is known: a table's rows, a profile. - Don't: A short wait, or one of unknown shape: show nothing, or a spinner in the button that started it. Progress you can measure: use `Progress`. ```svelte
``` Example: Basic Blocks shaped like the content that is loading; the region is marked busy. ```svelte
``` Example: Card A card while it loads: the same parts, with skeletons for the text. ```svelte ``` ### Slider A value picked by dragging a thumb along a track, or with the arrow keys (Page Up and Down for big steps, Home and End for the ends): `type="single"` binds a number, `type="multiple"` a number[] with one thumb each (a range). `min`, `max`, `step`, `orientation`. Inside a `Field` the thumbs are named by `Field.Label` and described by its description and error; outside one, give each thumb a name with `aria-label`. - Category: Data input - Import: `import { Slider } from '@limerdev/zest'` - Bits UI: `Slider`, https://bits-ui.com/docs/components/slider - Exports: `Slider` - Use for: A value where the rough position matters more than the exact number: volume, a price range filter, a percentage. - Don't: An exact number people type: use `Input type="number"`. Few options: use `RadioGroup` or `ToggleGroup`. ```svelte Billable share {rate}% of logged time. ``` Props of `Slider`: - `autoSort` (`boolean`, default `true`): Whether to automatically sort the values in the array when moving thumbs past one another. - `dir` (`"ltr" | "rtl"`, default `'ltr'`): The direction of the slider. For vertical sliders, setting `dir` to `'rtl'` will caus the slider to start from the top and move downwards. For horizontal sliders, setting `dir` to `'rtl'` will cause the slider to start from the left and move rightwards. - `disabled` (`boolean`, default `false`): Whether the slider is disabled or not. - `max` (`number`, default `100 (for number step) or the max value of the step array (for array step)`): The maximum value of the slider. - `min` (`number`, default `0 (for number step) or the min value of the step array (for array step)`): The minimum value of the slider. - `onValueChange` (`OnChangeFn | OnChangeFn`): A callback function called when the value changes. - `onValueCommit` (`OnChangeFn | OnChangeFn`): A callback function called when the user stops dragging the thumb and the value is committed. - `orientation` (`"horizontal" | "vertical"`, default `'horizontal'`): The orientation of the slider. - `step` (`number | number[]`, default `1`): The amount to increment the value by when the user presses the arrow keys, or an array of specific values that the slider can snap to. When an array is provided, the slider will only allow values that exist in the array, creating discrete tick points. The array values should be within the min/max range and will be automatically sorted. - `thumbPositioning` (`"exact" | "contain"`, default `"contain"`): The positioning of the slider thumb. - `trackPadding` (`number`): Padding percentage for the track. Creates space before the first and after the last tick positions. This can also be used as an SSR-friendly alternative to `thumbPositioning="contain"`, which requires client-side measurement. - `type` (`"multiple" | "single"`, required): The type of slider. If set to `'multiple'`, the slider will allow multiple ticks and the `value` will be an array of numbers. - `value` (`number | number[]`, default `min`, bindable): The value of the slider. Example: Basic In a Field, the label names the thumb. Arrow keys move by step. ```svelte Billable share {share}% of logged time is billed. ``` Example: A range type="multiple" picks a range with two thumbs; name each thumb outside a Field. ```svelte

Projects with {hours[0]}–{hours[1]} hours logged

``` ### Spinner A turning circle for a wait of unknown length. It is a status region named by `label` ("Loading" by default), so a screen reader announces it when it appears. It is 16px and takes the text colour; `class` sizes and colours it (`size-6 text-muted`). It stops turning with reduced motion. - Category: Feedback - Import: `import { Spinner } from '@limerdev/zest'` - Exports: `Spinner` - Use for: A short wait the user started: saving, a search, loading the next page. In a button, use the Button's `loading` instead. - Don't: A first load whose layout is known: use `Skeleton`. Progress you can measure: use `Progress`. Several spinners on one screen: show one for the region that is loading. ```svelte

Loading invoices…

``` Props of `Spinner`: - `label` (`string`, default `the Config's `strings.loading`, else 'Loading'`): What is happening, for screen readers. Example: Basic A wait of unknown length, named for screen readers by label. ```svelte

Loading invoices…

``` Example: Sizes and colours class sizes and colours it; it takes the text colour by default. ```svelte
``` ### Switch An on/off switch with `bind:checked`, for a setting that applies at once. With `name` it submits with a form. Inside a `Field` it takes its id, label, description, error and disabled state from the Field; use `orientation="horizontal"` to put the label beside it. - Category: Data input - Import: `import { Switch } from '@limerdev/zest'` - Bits UI: `Switch`, https://bits-ui.com/docs/components/switch - Exports: `Switch` - Use for: A setting that takes effect immediately: notifications on, dark rows, show archived. - Don't: A choice that only counts when a form is submitted: use `Checkbox`. A Switch without a label. ```svelte Show archived projects ``` Props of `Switch`: - `checked` (`boolean`, default `false`, bindable): The checked state of the switch. - `disabled` (`null | false | true`, default `false`): Whether the switch is disabled. - `name` (`string`, default `undefined`): The name of the switch used in form submission. If not provided, the hidden input will not be rendered. - `onCheckedChange` (`OnChangeFn`): A callback function called when the checked state changes. - `required` (`boolean`, default `false`): Whether the switch is required (for form validation). - `value` (`any`, default `undefined`): The value of the switch used in form submission. Example: Basic A Switch applies at once. ```svelte Show archived projects ``` Example: Settings A list of settings: label and description first, the switch at the end. ```svelte Email me when a week is approved One email per approved week. Remind me on Fridays If the week has days without hours. Weekly summary Turned off by your organisation. ``` ### Table A table of data: `` (in a container that scrolls sideways when it is too wide) holds a `Table.Header`, a `Table.Body` and an optional `Table.Footer`, each of `Table.Row`s of `Table.Head` (column headings) and `Table.Cell`s, and a `Table.Caption` that names it. Rows highlight on hover; `data-state="selected"` on a row marks it selected. A `Table.Head` with `sort` (`ascending`, `descending` or `none`) is a sort button with `aria-sort` that calls `onSort`. It is the native table, so screen readers read it as one; the app sorts, selects and pages the rows. - Category: Data display - Import: `import { Table } from '@limerdev/zest'` - Exports: `Table.Root`, `Table.Header`, `Table.Body`, `Table.Footer`, `Table.Row`, `Table.Head`, `Table.Cell`, `Table.Caption` - Use for: Records people compare across columns: invoices, users, time entries. - Don't: Laying out a page or a form: use CSS grid. A list of one-line items: a list. ```svelte Invoices this month Invoice Status Amount 1042 Paid 4 200 kr ``` Props of `Table.Head`: - `onSort` (`(() => void)`, default `undefined`): Called when the sort button is clicked; the app sets the next `sort`. - `sort` (`"none" | "ascending" | "descending"`, default `undefined`): Makes the column sortable: the heading becomes a button with an arrow, and the cell gets `aria-sort`. `none` is sortable but not sorted now. Left unset, the column isn't sortable. The app sorts the rows. Example: Basic A caption names the table; Table.Footer holds the totals. ```svelte Invoices this month Invoice Customer Status Amount {#each invoices as invoice (invoice.number)} {invoice.number} {invoice.customer} {invoice.status} {kr.format(invoice.amount)} {/each} Total {kr.format(total)} ``` Example: Selection Rows with a Checkbox: data-state="selected" marks a chosen row. The heading's Checkbox selects all, and is indeterminate while only some are. ```svelte {selected.length} of {users.length} users selected 0 && selected.length < users.length} onCheckedChange={toggleAll} /> Name Email {#each users as user (user.id)} toggle(user.id, checked)} /> {user.name} {user.email} {/each} ``` Example: Sorting sort on Table.Head makes the heading a button with aria-sort; onSort is yours, and so is the sorting. ```svelte Invoices, sorted by {column} Invoice sortBy('client')}> Client sortBy('amount')} > Amount {#each rows as invoice (invoice.id)} {invoice.id} {invoice.client} {invoice.amount} kr {/each} ``` ### Tabs Panels shown one at a time, chosen with tabs: `` (`bind:value`, `orientation`) holds a `Tabs.List` of `Tabs.Trigger`s and a `Tabs.Content` per tab, matched by `value`. Arrow keys move between tabs and show their panel; Tab moves into the panel. - Category: Navigation - Import: `import { Tabs } from '@limerdev/zest'` - Bits UI: `Tabs`, https://bits-ui.com/docs/components/tabs - Exports: `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content` - Use for: Views of the same thing side by side on one page: a project's overview, hours and settings; a form split into a few sections. - Don't: Moving between pages: use links (a `NavigationMenu` or a sidebar). Steps the user must go through in order. Many tabs that don't fit: use a `Select` or a sidebar. ```svelte Overview Hours … … ``` Props of `Tabs.Root`: - `activationMode` (`"manual" | "automatic"`, default `"automatic"`): How the tabs should be activated. If set to `'automatic'`, the tabs will be activated when the trigger is focused. If set to `'manual'`, the tabs will be activated when the trigger is pressed. - `disabled` (`boolean`, default `false`): Whether the tabs are disabled or not. - `loop` (`boolean`, default `false`): Whether to loop through the tabs when reaching the end when using the keyboard. - `onValueChange` (`OnChangeFn`): A callback function called when the selected tab changes. - `orientation` (`"horizontal" | "vertical"`, default `"horizontal"`): The orientation of the tabs. - `value` (`string`, default `''`, bindable): The value of the selected tab. Props of `Tabs.Trigger`: - `disabled` (`null | false | true`, default `false`): Whether the trigger is disabled or not. - `value` (`string`, required): The value of the tab associated with this trigger. Props of `Tabs.Content`: - `value` (`string`, required): The value of the tab associated with this content. Example: Basic Views of one project. Arrow keys move between tabs. ```svelte Overview Hours Settings Twelve people on three projects. Next invoice on 15 December. 412 hours logged this month, 380 billable. Billing contact, rates and reminders. ``` Example: Vertical orientation="vertical" stacks the tabs beside the panels; Up and Down move. ```svelte General Billing Members

Name, timezone and language.

The tabs keep their own height, however tall the panel beside them grows.

Each setting is saved as soon as it changes.

Invoice address and payment terms. Who can log and approve hours.
``` ### Textarea A multi-line text input with `bind:value` that grows with its text. Inside a `Field` it takes its id, label, description, error and disabled state from the Field. - Category: Data input - Import: `import { Textarea } from '@limerdev/zest'` - Exports: `Textarea` - Use for: Free text longer than a line: a comment, a description, a note on an order. - Don't: A single line of text: use `Input`. A Textarea without a label. ```svelte Note