### Install @shardsui/svelte
Source: https://github.com/abdrizik/shardsui/blob/main/README.md
Install the package via npm. Requires Svelte version 5.40 or higher.
```sh
npm i @shardsui/svelte
```
--------------------------------
### Configure Custom Navigation Links
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/navigation-menu.md
Examples for rendering standard links and applying SvelteKit-specific attributes for navigation behavior.
```svelte
Docs
```
```svelte
Docs
```
--------------------------------
### Inline Combobox Configuration
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/combobox.md
Example of configuring the Combobox.Root component for inline rendering.
```jsx
```
--------------------------------
### Drawer State Management
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/drawer.md
Examples of using the Drawer in uncontrolled mode or controlled mode via state binding.
```svelte
OpenExample drawerClose
```
```svelte
(open = next)}>
OpenExample drawerClose
```
--------------------------------
### Dialog State Management
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/dialog.md
Examples of handling dialog open state, including uncontrolled, controlled, and side-effect patterns.
```svelte
OpenExample dialogClose
```
```svelte
(open = next)}>
Open
```
```svelte
{
// Do stuff when the dialog is closed
if (!next) {
doStuff()
}
// Set the new state
open = next
}}
>
...
```
--------------------------------
### Run project verification commands
Source: https://github.com/abdrizik/shardsui/blob/main/CLAUDE.md
Execute these commands in sequence to verify component integrity, run tests, and check documentation.
```bash
pnpm -C packages/shardsui check
```
```bash
pnpm test
```
```bash
pnpm test:chromium
```
```bash
pnpm -C docs check
```
--------------------------------
### Creating a manager instance
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/toast.md
Instantiate a global Toast manager and provide it to the application via the Toast.Provider component.
```svelte
{#each Toast.getToastManager().toasts as toast (toast.id)}
{/each}
```
--------------------------------
### Import Components
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/quick-start.md
Import specific components from their individual entry points.
```svelte
```
--------------------------------
### Initialize PreviewCard Handle
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/preview-card.md
Instantiate a new Handle to control a PreviewCard imperatively, optionally providing a type argument for the payload.
```ts
const previewCard = new PreviewCard.Handle()
```
--------------------------------
### Initialize Menu Handle
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/menu.md
Instantiate a new Menu.Handle to control a menu imperatively. Use the generic type argument to define the payload structure.
```ts
const menu = new Menu.Handle()
```
--------------------------------
### Using an Input with Toolbar
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/toolbar.md
Include a Toolbar.Input which participates in the toolbar's single tab stop and arrow-key navigation.
```svelte
Bold
```
--------------------------------
### Configure backdrop and release timing
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/drawer.md
Adjusts backdrop opacity and transition durations based on swipe progress and velocity.
```css
.drawer-backdrop {
--backdrop-opacity: 0.2;
opacity: calc(var(--backdrop-opacity) * (1 - var(--drawer-swipe-progress)));
}
.drawer-popup[data-ending-style],
.drawer-backdrop[data-ending-style] {
transition-duration: calc(var(--drawer-swipe-strength) * 400ms);
}
.drawer-popup[data-swiping],
.drawer-backdrop[data-swiping] {
transition-duration: 0ms;
}
```
--------------------------------
### Mixing stacked and anchored toasts
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/toast.md
Demonstrates how to use separate Toast.Manager instances to manage anchored and stacked toasts independently within different providers.
```svelte
```
--------------------------------
### Create a Link Menu Item
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/menu.md
Render a menu item as a navigation link by using Menu.LinkItem.
```svelte
Go to Projects
```
--------------------------------
### Initialize Popover Handle
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/popover.md
Instantiate a new Popover.Handle to manage popover state and interactions.
```ts
const popover = new Popover.Handle()
```
--------------------------------
### Initialize Tooltip Handle
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/tooltip.md
Instantiate a new Tooltip.Handle with an optional payload type for managing tooltip state.
```ts
const tooltip = new Tooltip.Handle()
```
--------------------------------
### Using createFilter with Autocomplete
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/autocomplete.md
Demonstrates initializing a filter with Intl.Collator options and applying it to an item list within a Svelte component.
```svelte
```
--------------------------------
### Implement Menubar Anatomy
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/menubar.md
Structure a Menubar by nesting Menu.Root components within the Menubar container.
```svelte
```
--------------------------------
### Nesting components with context
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/composition.md
Demonstrates how parts like Menu.Trigger and Menu.Item read state from Menu.Root via Svelte context.
```svelte
SongAdd to Library
```
--------------------------------
### Select Component Props
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/select.md
Configuration properties for the main Select component.
```APIDOC
## Select Component Props
### Properties
- **highlightItemOnHover** (boolean) - Optional - Highlights items as the pointer moves over them. Default: true.
- **items** (readonly { value, label }[] | readonly { items: Value[] }[] | Record) - Required - Items Select.Value resolves labels from.
- **itemToStringLabel** ((item) => string) - Optional - Converts an item to its display label.
- **itemToStringValue** ((item) => string) - Optional - Converts an item to its form value string.
- **isItemEqualToValue** ((item, value) => boolean) - Optional - Compares an item to the current value. Default: Object.is.
- **id** (string) - Optional - Base id for the trigger and the generated part ids.
```
--------------------------------
### Drawer.Provider
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/drawer.md
Tracks the open state of every drawer inside it, driving Indent and IndentBackground components.
```APIDOC
## Drawer.Provider
### Description
Tracks the open state of every drawer inside it, driving `` and ``. It does not render its own HTML element.
### Props
- **children** (Snippet) - Required - Content.
```
--------------------------------
### Implement Preview Card Anatomy
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/preview-card.md
The component structure requires a root, trigger, and portal-based popup container. Ensure all sub-components are nested correctly within the root.
```svelte
```
--------------------------------
### Initialize Drawer Handle
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/drawer.md
Instantiate a new Drawer.Handle with an optional generic type for the payload.
```ts
const drawer = new Drawer.Handle()
```
--------------------------------
### Input Component API
Source: https://github.com/abdrizik/shardsui/blob/main/docs/src/content/input.md
Reference for the Input component props and configuration.
```APIDOC
## Input Component
### Description
A text entry field component that can render as an or