Types
Every type the package exports, printed from the source. The prop tables link here whenever a
prop is typed as one of them, so variant?: ButtonVariant is one click away from the six
strings it allows.
You rarely need to import any of these. Props are inferred, and the union types exist so your
editor can finish the string for you. Import them when you are passing values around: a SelectOption[] coming out of a load function, or your own wrapper component that forwards
a variant.
Component types
AlertVariant
components/feedback/Alert.svelteexport type AlertVariant = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';BadgeVariant
components/primitives/Badge.svelteexport type BadgeVariant =
'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'outline';ButtonSize
components/primitives/Button.svelteexport type ButtonSize = 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';ButtonVariant
components/primitives/Button.svelteexport type ButtonVariant = 'solid' | 'soft' | 'outline' | 'ghost' | 'link' | 'danger';Command
components/overlays/CommandPalette.svelteexport interface Command {
id: string;
label: string;
/** Commands with the same group are listed under one heading. */
group?: string;
/** Shown on the right, usually a shortcut. */
hint?: string;
/** Extra words that should find this command. */
keywords?: string[];
icon?: Snippet;
disabled?: boolean;
onselect: () => void;
}Crumb
components/navigation/Breadcrumb.svelteexport interface Crumb {
label: string;
href?: string;
}SegmentedOption
components/forms/SegmentedControl.svelteexport interface SegmentedOption {
value: string;
label: string;
disabled?: boolean;
}SelectOption
components/forms/Select.svelteexport interface SelectOption {
value: string;
label: string;
disabled?: boolean;
}TabsVariant
components/navigation/Tabs.svelteexport type TabsVariant = 'line' | 'pill';TerminalLine
components/effects/Terminal.svelteexport interface TerminalLine {
/** `command` lines are typed after the prompt; `output` lines appear whole. */
kind?: 'command' | 'output';
text: string;
tone?: 'default' | 'muted' | 'success' | 'accent' | 'warning' | 'danger';
/** Pause before this line, in milliseconds. Overrides `lineDelay`. */
delay?: number;
}TriggerAttrs
components/overlays/Popover.svelteexport interface TriggerAttrs {
onclick: (event: MouseEvent) => void;
'aria-expanded': boolean;
'aria-haspopup': 'dialog' | 'menu';
}Theme and toasts
Accent
state/theme.svelte.tsexport type Accent = (typeof accents)[number] | (string & {});
export const accents = ['plum', 'cobalt', 'pine', 'ember', 'gold', 'ink'] as const;ThemeMode
state/theme.svelte.tsexport type ThemeMode = 'light' | 'dark' | 'system';Toast
state/toast.svelte.tsexport interface Toast extends ToastOptions {
id: string;
title: string;
variant: ToastVariant;
duration: number;
}
export interface ToastOptions {
title?: string;
description?: string;
variant?: ToastVariant;
/** Milliseconds before it dismisses itself. `0` keeps it until dismissed. */
duration?: number;
action?: { label: string; onclick: () => void };
}
export type ToastVariant = 'default' | 'success' | 'warning' | 'danger' | 'info';ToastOptions
state/toast.svelte.tsexport interface ToastOptions {
title?: string;
description?: string;
variant?: ToastVariant;
/** Milliseconds before it dismisses itself. `0` keeps it until dismissed. */
duration?: number;
action?: { label: string; onclick: () => void };
}
export type ToastVariant = 'default' | 'success' | 'warning' | 'danger' | 'info';ToastVariant
state/toast.svelte.tsexport type ToastVariant = 'default' | 'success' | 'warning' | 'danger' | 'info';Actions
ClickOutsideParams
actions/clickOutside.tsexport type ClickOutsideParams =
| Handler
| {
handler: Handler;
/** Presses inside these elements do not count as outside. */
ignore?: (HTMLElement | null | undefined)[];
};
type Handler = (event: PointerEvent) => void;Helpers
AnchorParams
utils/anchor.tsexport interface AnchorParams {
/** The element the panel should sit next to. */
to: HTMLElement | null | undefined;
placement?: Placement;
/** Gap between anchor and panel, in pixels. */
offset?: number;
/** Minimum distance to the viewport edge. */
padding?: number;
}
export type Placement =
'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'right';ClassValue
utils/cn.tsRe-exported unchanged from clsx.
export type { ClassValue } from 'clsx';ConfettiOptions
utils/confetti.tsexport interface ConfettiOptions {
/** Where the burst starts: an element's centre, or a point in viewport pixels. */
origin?: HTMLElement | { x: number; y: number };
/** Number of pieces. */
count?: number;
/** Width of the cone, in degrees. */
spread?: number;
/** Middle of the cone, in degrees: -90 is straight up, 0 is to the right. */
angle?: number;
/** Launch speed; around 10 clears a button, 16 clears the screen. */
velocity?: number;
/** How hard the pieces fall. Below 1 they hang about, above 1 they drop. */
gravity?: number;
/** Size of the pieces, as a multiplier. */
scale?: number;
/** CSS colours. Defaults to the theme's accent and status colours. */
colors?: string[];
/** Milliseconds until every piece has faded. */
duration?: number;
}Placement
utils/anchor.tsexport type Placement =
'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'right';