# Introduction Learn more about Skeleton and how it can serve you. Skeleton provides a uniform design language and structured framework for controlling the look and feel of your product and user experience. It serves as an opinionated design system that aims to greatly reduce the amount of time spent managing design elements and patterns, allowing you to more quickly build and manage your frontend interfaces at scale. ## In a Nutshell ## Our Philosophy ## Additional Benefits # Installation Learn how to install and setup Skeleton for your project. ## Guides ## Mixing UI Libraries Skeleton's design system is perfect for complementing headless component libraries, such as [Bits UI](/docs/\[framework]/integrations/bits-ui), [Melt UI](/docs/\[framework]/integrations/melt-ui), [Radix](/docs/\[framework]/integrations/radix-ui), and [Zag.js](https://zagjs.com/). As well as "Tailwind component" libraries such as the [Tailwind Plus](https://tailwindcss.com/plus). Supporting any component system that supports Tailwind, but very specifically allows you to insert or substitute Skeleton-provided utility classes. ### Unsupported Libraries Unfortunately, Skeleton cannot integrate with [Flowbite React](https://flowbite-react.com/), [Flowbite Svelte](https://flowbite-svelte.com/), or [Daisy UI](https://daisyui.com/) at this time. Similar to Skeleton, these libraries make changes to Tailwind that directly overlaps with many of our core features, including class names and color values. # Fundamentals An introduction to the core concepts of Skeleton. *** ## Design System ### Figma UI Kit A fully featured [Figma UI Kit](https://www.etesie.dev/figma) is available to designers, allowing them to quickly draft visual concept of your project. ### Core Features The following features fall under the umbrella of our design system. Provided via the Skeleton core. *** ## Tailwind Components Tailwind components that act as primitives for creating complex interfaces. Provided via the Skeleton core. *** ## Functional Components Skeleton also offers optional component packages for select component frameworks. Each component automatically adapts to Skeleton's design system. While still allowing a high level of customization. \| Framework | NPM Package | Description | \| --------- | ------------------------------- | ------------------------------- | \| React | `@skeletonlabs/skeleton-react` | Contains all React components. | \| Svelte | `@skeletonlabs/skeleton-svelte` | Contains all Svelte components. | ### Powered by Zag.js Skeleton's components are built on **Zag.js**, which provides a collection of framework-agnostic UI component patterns to manage logic and state. Zag is actively maintained by industry veterans, such as [Segun Adebayo](https://github.com/segunadebayo) - the creator and core maintainer for [Chakra UI](https://www.chakra-ui.com/), [Ark UI](https://ark-ui.com/), and [PandaCSS](https://panda-css.com/). ### Importing Components You may import components per each Skeleton framework as follows. ```ts import { Avatar } from '@skeletonlabs/skeleton-{react|svelte}'; ``` This also includes access to the component prop types. ```ts import type { AvatarRootProps, ... } from '@skeletonlabs/skeleton-{react|svelte}'; ``` ### Composed Pattern Skeleton components are granular. This offers direct access to all children within the tree, similar to working with raw HTML. This allows passing in arbitrary props and attributes directly to the the template within. Including: `required`, `data-*`, `style`, `class`, and more. ```svelte SK ``` ### Styling Components Skeleton components implement a universal convention for accepting CSS utility classes via the `class` attribute. Use this to pass any CSS utility class. ```svelte SK ``` By default, all internal styles are auto-prefixed to ensure they are assigned to the `@base` layer in the Tailwind bundle. This ensures any classes you pass through the `class` attribute are automatically given precedence. No mental overhead, it just works. ```css @custom-variant skb { @layer base { @slot; } } ``` ### Extensible Markup Skeleton components provide a mechanism for overwriting the internal HTML with custom markup. Use the `element` prop in React, and the `element` snippet in Svelte to obtain the internal `attributes`. Then spread these to your custom elements. Note that this is an optional and advanced feature aimed at power users, and show not be needed for normal usage. **React:** ```tsx export default function () { return ( {/* ... */}

} />

Content for Item 1
{/* ... */}
); } ``` **Svelte:** ```svelte

{#snippet element({ attributes })} {/snippet}

Content for Item 1
``` ### Custom Animations However, using the extensible markup pattern, you may implement custom animations. While we showcase this below with [Svelte Transitions](https://svelte.dev/docs/svelte/transition), but you could also use framework agnostic solutions such as [Motion](https://motion.dev/), [Anime.js](https://animejs.com/), or [Animate.css](https://animate.style/). ```ts import { slide } from 'svelte/transition'; ``` ```svelte

Item 1

{#snippet element(attributes)} {#if !attributes.hidden} {/if} {/snippet}
``` 1. Implement the `element` snippet to gain access to the `attributes`. 2. Spread the `attributes` to the custom element, a `
` in this example. 3. Override the `hidden` attribute to `false` to prevent it from showing/hiding the element too soon. 4. Add the `transition:slide` and configure your preferred options. 5. Then implement the wrapping `#if` block that triggers transitions when `attribute.hidden` is toggled. ### Provider Pattern Most Skeleton components also support the Provider Pattern. This utilizes a provider component that replaces the root and provides access to the inner component APIs. In practice, this allows direct access to Zag.js API features, such as programmatic control for overlay components, the ability to clear input components, and more. ```svelte Anchor Content ``` ### Learn More For a comprehensive guide to how Skeleton implements components, refer to our [contribution guidelines](/docs/\[framework]/resources/contribute/components). # Core API Learn about the specific features Skeleton introduces to Tailwind. The heart of Skeleton is our framework agnostic core package. This adapts and extends Tailwind to introduce our global styles, color system, typography, and more. This section details all available Skeleton-provided utility classes and theme properties. ## @base Extends Tailwind's base layer with a set of opinionated global styles. * Sets the root color scheme to match Dark Mode settings. * Updates scrollbars to utilize theme colors. * Updates global text selection to utilize theme colors. * Defines the `` background colors and base font styles. * Implements global default styles for disabled states, such as buttons. ## @theme Uses Tailwind's `@theme` to implement a variety of new properties and utility classes. ### Colors Extends colors to include the [Skeleton color palette](/docs/\[framework]/design/colors). \| Class | Theme Property | \| ------------------------------------- | ------------------------------------ | \| `[property]-[color]-[shade]` | color-\[color]-\[shade] | \| `[property]-[color]-contrast-[shade]` | color-\[color]-contrast-\[shade] | \| `body-background-color` | body-background-color | \| `body-background-color-dark` | body-background-color-dark | ### Color Pairings Extends colors to implement [Color Pairing](/docs/\[framework]/design/colors#color-pairings), which balance colors between light and dark mode. \| Class | Theme Property | \| ------------------------------------ | ----------------------------------- | \| `[property]-[color]-[shade]-[shade]` | color-\[color]-\[shade]-\[shade] | ### Spacing Integrates Tailwind's [spacing property](https://tailwindcss.com/docs/functions-and-directives#spacing-function) to modify [dynamic scaling](/docs/\[framework]/design/spacing) for various utility classes. \| Class | Theme Property | \| --------- | -------------- | \| (various) | spacing | ### Typography Introduces a [typographic scale](https://designcode.io/typographic-scales) to all Tailwind [font sizes](https://tailwindcss.com/docs/font-size) using the following formula. ```plaintext --text-{size}: calc({remSize} * var(--text-scaling)); --text-{size}--line-height: calc(calc(1 / {remSize}) * var(--text-scaling)); ``` #### Base Controls the style of the global page text. \| Class | Theme Property | \| ---------------------- | -------------------------- | \| `base-font-color` | base-font-color | \| `base-font-color-dark` | base-font-color-dark | \| `base-font-family` | base-font-family | \| `base-font-size` | base-font-size | \| `base-line-height` | base-line-height | \| `base-font-weight` | base-font-weight | \| `base-font-style` | base-font-style | \| `base-letter-spacing` | base-letter-spacing | #### Heading Controls the style of the heading text. \| Class | Theme Property | \| ------------------------- | ----------------------------- | \| `heading-font-color` | heading-font-color | \| `heading-font-color-dark` | heading-font-color-dark | \| `heading-font-family` | heading-font-family | \| `heading-font-size` | heading-font-size | \| `heading-line-height` | heading-line-height | \| `heading-font-weight` | heading-font-weight | \| `heading-font-style` | heading-font-style | \| `heading-letter-spacing` | heading-letter-spacing | #### Anchor Controls the style of anchor links. \| Class | Theme Property | \| ------------------------------- | ----------------------------------- | \| `anchor-font-color` | anchor-font-color | \| `anchor-font-color-dark` | anchor-font-color-dark | \| `anchor-font-family` | anchor-font-family | \| `anchor-font-size` | anchor-font-size | \| `anchor-line-height` | anchor-line-height | \| `anchor-font-weight` | anchor-font-weight | \| `anchor-font-style` | anchor-font-style | \| `anchor-letter-spacing` | anchor-letter-spacing | \| `anchor-text-decoration` | anchor-text-decoration | \| `anchor-text-decoration-active` | anchor-text-decoration-active | \| `anchor-text-decoration-focus` | anchor-text-decoration-focus | \| `anchor-text-decoration-hover` | anchor-text-decoration-hover | ### Radius Extends Tailwind's radius properties with theme-specific sizes. \| Class | Theme Property | \| ------------------- | ---------------------- | \| `rounded-base` | radius-base | \| `rounded-container` | radius-container | ### Edges Sets the default width for border, divide, and ring width to match the active theme properties. \| Class | Theme Property | \| -------- | -------------------------- | \| `border` | default-border-width | \| `ring` | default-ring-width | \| `divide` | default-divide-width | ## @utility ### Tailwind Components Allow you to style semantic HTML elements with utility classes. ## @variant ### Themes Enables you to target and style elements for a particular theme. ```html
...
...
...
``` ## Optional ### Presets Provides a canned set of styles for use with buttons, badges, cards, and more. ### Preset Themes Provides a hand curated set of themes for Skeleton. # Migrate from v2 Learn how to migrate from Skeleton v2 to the latest version. Version 3 represents a major overhaul to Skeleton. This includes a ground up rewrite of quite literally every feature in the library. We have provided a migration CLI to help automate this process. However, some portions of this migration will still required manual intervention. This is not a trivial migration from prior versions, so please use caution when updating and ensure you follow this guide very carefully. ## Prerequisites While Skeleton v3 introduces support for multiple frameworks, we’ve historically only supported SvelteKit. As such, this guide is only intended for users migrating from Skeleton v2 and SvelteKit. If you you are coming from another meta-framework, this will be outside the scope of this guide. However, this may still provide a valuable insight to the primary objectives for migration. ### Create a Migration Branch We recommend you handle all migration changes on a dedicated feature branch. This ensures you can easily drop or revert changes if something goes wrong. ```bash git checkout -b migration ``` ### Prepare Your Skeleton App Please make sure you have accounted for the following: * Your app is running the latest release of Skeleton v2.x * All critical dependencies have been updated (optional but recommended) * Your app is in a functional state before you proceed *** ## Migrate Core Technologies Skeleton is built on top of the following technologies. These must be migrated individually before proceeding with the Skeleton-specific migration. Note that Svelte and Tailwind provide dedicated CLIs to automate this process. ### Svelte v5 Migrate to the latest release of Svelte v5. ### SvelteKit v2 Migrate to the latest release of SvelteKit v2. ### Tailwind v4 Before migration to tailwind v4 using their upgrade guide some manual steps are required: 1. Remove the `skeleton` plugin from your `tailwind.config` file. 2. Rename your `app.postcss` or `app.pcss` to `app.css`. 3. Remove the `purgecss` (`vite-plugin-tailwind-purgecss`) vite plugin from your `vite.config` (if installed). Migrate to the latest release of Tailwind v4. > TIP: Having trouble running Tailwind's automated migration script due to `@apply`? Remove the classes temporarily, then follow [these steps](/docs/\[framework]/get-started/migrate-from-v2#replacing-apply) to adapt to native CSS custom properties and Tailwind's new utilities. *** ## Migrate to the Tailwind Vite Plugin Use the following steps to migrate to from PostCSS to the Vite plugin: 1. Delete `postcss.config.mjs` 2. Run `npm uninstall postcss @tailwindcss/postcss` 3. Run `npm install @tailwindcss/vite` 4. Open your `vite.config` in the root of your project 5. Import the following at the top of the file: `import tailwindcss from '@tailwindcss/vite'` 6. Finally, add the Vite plugin ABOVE your specific framework plugin: ```ts plugins: [ tailwindcss(), sveltekit(), // or svelte() ]; ``` *** ## Automated Migration We’ve provided a dedicated migration script as part of the Skeleton CLI to help automate much of this process. > TIP: Please ensure you've committed all pending changes before proceeding. ```bash npx skeleton migrate skeleton-3 ``` What WILL be migrated... * Update all required `package.json` dependencies * Implement all required Skeleton imports in your global stylesheet `app.css` * Modify `data-theme` in `app.html` if you’re using a Skeleton preset theme. * Temporarily disable custom theme imports to allow for theme migration. * Migrate all modified Skeleton utility classes (ex: `variant-*` to `preset-*`) * Update all Skeleton imports throughout your entire project * Renames all relevant Skeleton components * Some Component imports will also be pruned as they are no longer supported. We’ll cover these features in detail below. What will NOT be migrated... * Component props will not be updated. Unfortunately there’s too many permutations. * Most v2 Utility features will not be migrated (ex: popovers, code blocks, etc) Make sure to consult your local Git Diff to compare what has been modified before progressing forward or committing these automated changes. *** ## Manual Migration With automated migration complete, please follow the remaining manual migration steps. ### Migrate Themes #### For Preset Themes Your preset theme should be automatically migrated by the CLI, you're all set! #### For Custom Themes 1. Use the [Import feature](https://themes.skeleton.dev/themes/import) provided by the new Theme Generator. 2. Drag and Drop your v2 theme into the file upload field. 3. Your theme will be automatically converted to the newest format. 4. Update and modify any theme settings in the live preview. 5. Make sure to set a valid theme name in the right-hand panel. 6. Tap the “Code” tab to preview your generated theme code. 7. Copy the theme code, then following our [custom theme instructions](/docs/\[framework]/design/themes#custom-themes). 8. Similar to preset themes, you will need to both register and set an active theme. ### Replace AppShell with Custom Layouts Skeleton has sunset the ([troublesome](https://github.com/skeletonlabs/skeleton/issues/2383)) `` component in favor of user-defined custom layouts. We've provided a [Layouts](/docs/\[framework]/guides/layouts) guide for replicating common page structures using only semantic HTML and Tailwind - no Skeleton specific features needed! ### Migrating Components > NOTE: if you're aiming to migrate to Skeleton v4, we recommend you skip this specific step and follow [the v4 migration guide instead](/docs/\[framework]/get-started/migrate-from-v3). Once complete, resume from the "Tailwind 4 Changes" section below, and continue through the remainder of this guide. Components have undergone the biggest update in Skeleton v3. Given the sheer number of changes, we recommend you compare each component to it's equivalent v3 documentation. We’ve highlighted a few of the key changes below: * Changes to adopt the new [Svelte 5 APIs](https://svelte.dev/docs/svelte/v5-migration-guide) like runes, snippets, event handlers, etc. * Changes to support [Zag.js](https://zagjs.com/), which serves as a foundation of our cross-framework components. * Changes to the import path: `@skeletonlabs/skeleton-svelte`. * Changes to the component name and/or structure (including sub-components) * Changes based on newly introduces features and properties. * Changes to adopt the new [component fundamentals](/docs/\[framework]/get-started/fundamentals#functional-components). Here's an example of changes for a single component from v2 to the new equivalent: ```svelte ``` ```svelte (value = e.value)} markers={[25, 50, 75]} /> ``` We’ve recorded the most notable changes to each component in the table below: \| Name | v2 | v3 | Notes | \| ------------------ | ----------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------- | \| `` | [Link](https://v2.skeleton.dev/components/app-rail) | [Link](https://v3.skeleton.dev/docs/components/navigation/svelte) | Renamed `` - greatly expanded features | \| `` | [Link](https://v2.skeleton.dev/components/file-buttons) | [Link](https://v3.skeleton.dev/docs/components/file-upload/svelte) | Renamed `` - merges `` features | \| `` | [Link](https://v2.skeleton.dev/components/file-buttons) | [Link](https://v3.skeleton.dev/docs/components/file-upload/svelte) | Renamed `` - merges `` features | \| `` | [Link](https://v2.skeleton.dev/components/input-chips) | [Link](https://v3.skeleton.dev/docs/components/tags-input/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/paginators) | [Link](https://v3.skeleton.dev/docs/components/pagination/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/progress-bars) | [Link](https://v3.skeleton.dev/docs/components/progress/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/progress-radials) | [Link](https://v3.skeleton.dev/docs/components/progress-ring/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/radio-groups) | [Link](https://v3.skeleton.dev/docs/components/segment/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/range-sliders) | [Link](https://v3.skeleton.dev/docs/components/slider/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/slide-toggles) | [Link](https://v3.skeleton.dev/docs/components/switch/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/tabs) | [Link](https://v3.skeleton.dev/docs/components/tabs/svelte) | Renamed `` | ### Tailwind v4 Changes Taliwind v4 represents a major update for Tailwind. We've detailed the most notable features as they may relate to your Skeleton project. Please consult the [Tailwind v4 announcement](https://tailwindcss.com/blog/tailwindcss-v4) post for the full roster of changes. * The `tailwing.config` has been removed in favor of [CSS-base configuration](https://tailwindcss.com/blog/tailwindcss-v4#css-first-configuration) in your global stylesheet. * Make sure you’re using the newest strategies for supporting [Dark Mode](/docs/\[framework]/guides/mode). * You are still required to implement the [Tailwind Forms Plugin](/docs/\[framework]/tailwind-components/forms#prerequisites) to use Skeleton form elements. * The Skeleton `data-theme` attribute has moved from `` to `` * Themes colors are now stored in the [oklch format](https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl), but optionally support any format. ### Replacing @apply We strongly encourage you take this opportunity to move away from any usage of `@apply`. Tailwind has long since advocated against heavy use of this, and Tailwind v4 introduces new directives and functions that make this much easier to avoid. Here's a trivial example: ```css /* Before */ .foo { @apply bg-surface-50-950 text-surface-950 dark:text-surface-50 p-4; } ``` ```css /* After */ .foo { background-color: var(--color-surface-50-950); color: var(--color-surface-950); padding: --spacing(4); @variant dark { color: var(--color-surface-50); } } ``` * Usage of `@apply` may be found in your global stylesheet or component ` ``` 1. **Filled** - a filled preset of the primary brand color. 2. **Tonal** - a tonal preset of the primary brand color. 3. **Outlined** - an outlined preset of the primary brand color. 4. **Glass** - a custom preset using background transparency and backdrop blur. 5. **Elevated** - mixes a filled preset with a shadow. 6. **Ghost** - has no style by default, but shows a tonal preset on hover. 7. **Ghost Icon** - has no style by default, but shows a branded tonal preset on hover. 8. **Gradient** - a custom preset generated using Tailwind gradient primitives. ## Skeleton Presets Skeleton's provides the following opinionated set of styles, including accessible backgrounds and text colors. ### Filled ```txt preset-filled-{color}-{lightModeShade}-{darkModeShade} ``` ```astro
{/* Neutral */}
(neutral)
{/* Colors */}
950-50
900-100
800-200
700-300
600-400
500
400-600
300-700
200-800
100-900
50-950
``` ### Tonal ```txt preset-tonal-{color} ``` ```astro
{/* Neutral */}
(neutral)
{/* Colors */}
primary
secondary
tertiary
success
warning
error
surface
``` ### Outlined ```txt preset-outlined-{color}-{shade}-{shade} ``` `preset-outlined-{color}-{shade}-{shade}` ```astro
{/* Neutral */}
(neutral)
{/* Colors */}
950-50
900-100
800-200
700-300
600-400
500
400-600
300-700
200-800
100-900
50-950
``` ## Custom Presets Consider these best practices when creating presets: * Custom presets are only limited by your imagination. * Use any combination of Skeleton or Tailwind-provided primitive to generate a preset. * Apply presets to any relevant element, including: buttons, cards, inputs, and more. * Use a set naming convention, such as `preset-{foo}` to keep things standardized. * Implement all presets in using Tailwind's [@utility directive](https://tailwindcss.com/docs/functions-and-directives#utility-directive) in your global stylesheet. * Abstrast presets to a stylesheet or NPM package for shared used between projects. Please be aware the following presets are not included by Skeleton. Rather, these are examples of how you might utilize the Preset pattern. ### Input Presets ```astro
``` ### Gradient Presets Tailwind provides a number of powerful [Gradient](https://tailwindcss.com/docs/gradient-color-stops) utility classes that can be used to generate presets. ```astro
Card
Card
Card
``` ### Glass Presets ```astro --- const baseClasses = 'card p-4 text-white text-center flex justify-start items-center'; ---
Neutral
Primary
Secondary
Tertiary
Success
Warning
Error
Surface
``` # Typography The Skeleton typography system. Skeleton provides an array of opt-in utility classes for common typographic elements, with a fully functional typography scale based on your theme settings. As well as a number of primitives for generating a semantic typography set for your project's individual needs. ## Typographic Scale Skeleton introduces customizable [Typographic Scale](https://designcode.io/typographic-scales) to Tailwind's [font-size](https://tailwindcss.com/docs/font-size) properties. ## Utility Classes Use the following utility classes to quickly style semantic HTML elements. These classes are opt-in by default, providing a simple escape hatch when you need to break from convention. ### Headings ```astro

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
``` ### Paragraphs ```astro

The quick brown fox jumps over the lazy dog

``` ### Blockquotes ```astro
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nesciunt, aliquid. Molestias, odio illum voluptatibus natus dignissimos, quidem est unde aspernatur veniam pariatur fuga distinctio esse in quas, repellendus neque reiciendis!"
``` ### Anchor ```astro Anchor ``` ### Pre-Formatted ```astro
The quick brown fox jumps over the lazy dog.
``` ### Code ```astro
Insert the .example class here.
``` ### Keyboard ```astro
Press + C to copy.
``` ### Insert & Delete ```astro
Always Gonna Give You Up Never Gonna Give You Up
``` ### Mark ```astro

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nesciunt, aliquid. Molestias, odio illum voluptatibus natus dignissimos, quidem est unde aspernatur veniam pariatur fuga.

``` ## Lists Skeleton defers to Tailwind's built-in utility classes for common list styles. ### Unordered ```astro
  • Id maxime optio soluta placeat ea eaque similique consectetur dicta tempore.
  • Repellat veritatis et harum ad sint reprehenderit tenetur, possimus tempora.
  • Lorem ipsum dolor sit amet consectetur adipisicing elit harum ad sint.
``` ### Ordered ```astro
  • Id maxime optio soluta placeat ea eaque similique consectetur dicta tempore.
  • Repellat veritatis et harum ad sint reprehenderit tenetur, possimus tempora.
  • Lorem ipsum dolor sit amet consectetur adipisicing elit harum ad sint.
``` ### Basic ```astro
  • Id maxime optio soluta placeat ea eaque similique consectetur dicta tempore.
  • Repellat veritatis et harum ad sint reprehenderit tenetur, possimus tempora.
  • Lorem ipsum dolor sit amet consectetur adipisicing elit harum ad sint.
``` ### Description ```astro
Item A
Id maxime optio soluta placeat ea eaque similique consectetur dicta tempore.
Item B
Repellat veritatis et harum ad sint reprehenderit tenetur, possimus tempora.
Item C
Lorem ipsum dolor sit amet consectetur adipisicing elit harum ad sint.
``` ### Navigation ```astro ``` ## Semantic Typography When working with your designers, they may craft a semantic typography set for your project. To handle this, we recommend implementing [custom presets](/docs/\[framework]/design/presets#custom-presets) that mix CSS primitives with semantic HTML elements to replicate all desired styles. Feel free to use the boilerplate below, adding each style to your global stylesheet. ```svelte
Class Preview
preset-typo-display-4

Aa

preset-typo-display-3

Aa

preset-typo-display-2

Aa

preset-typo-display-1

Aa

preset-typo-headline

Headline

preset-typo-title

Title

preset-typo-subtitle

Subtitle

preset-typo-body-1

Body 1

preset-typo-body-2

Body 2

preset-typo-caption Caption
preset-typo-menu Menu
preset-typo-button Button
``` # Spacing Set a dynamic scale for application whitespace. This is enabled by the [Tailwind spacing system](https://tailwindcss.com/blog/tailwindcss-v4#dynamic-utility-values-and-variants). This affects the following utilities. * `padding` * `margin` * `width` * `minWidth` * `maxWidth` * `height` * `minHeight` * `maxHeight` * `gap` * `inset` * `space` * `translate` # Iconography Learn how to integrate Lucide for iconography in Skeleton. Skeleton takes an agnostic approach to icons, meaning you can use any combination of SVGs, emoji, unicode, or dedicated icon libraries. Mix and match to fulfill your project's unique requirements. ## Lucide If you're looking for an opinionated solution, Skeleton recommends [Lucide](https://lucide.dev/). This provides a huge selection of icons that are available to all popular frameworks and feature a clean and modern style. All code examples in this documentation site implement Lucide, but feel free to replace with any alternative. ## Installation Follow the official instructions to install [Lucide for Svelte](https://lucide.dev/guide/packages/lucide-svelte). Follow the official instructions to install [Lucide for React](https://lucide.dev/guide/packages/lucide-react). ## Usage ```svelte ``` ```tsx import { SkullIcon } from 'lucide-react'; export default function App() { return ; } ``` ## Alternatives * [Iconify](https://iconify.design/) - provides a vast array of icon sets supported by popular icon libraries. * [Font Awesome](https://fontawesome.com/) - provides a huge variety of icons in their free tier. * [SimpleIcons](https://simpleicons.org/) - provides an excellent selection of brand icons. - [Radix Icons](https://www.radix-ui.com/icons) - features modern styles and a large selection, supports React only. - [Iconify](https://iconify.design/) - provides a vast array of icon sets supported by popular icon libraries. - [Font Awesome](https://fontawesome.com/) - provides a huge variety of icons in their free tier. - [HeroIcons](https://heroicons.com/) - from the makers of Tailwind CSS, supports React and Vue. - [SimpleIcons](https://simpleicons.org/) - provides an excellent selection of brand icons. # Badges Provides a robust set of non-interactive badge styles. ```astro --- import { HeartIcon } from 'lucide-react'; ---
Badge Badge
``` ## Presets Provides full support of [Presets](/docs/\[framework]/design/presets). ```astro
Badge Badge Badge
Badge Badge Badge
Badge Badge Badge
Badge Badge Badge
Badge Badge Badge
Badge Badge Badge
Badge Badge Badge
``` ## Overlap Use `badge-icon` to create overlapping numeric or icon badges. ```astro --- const imgSrc = 'https://images.unsplash.com/photo-1620122303020-87ec826cf70d?q=80&w=256&h=256&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'; ---
2 Avatar
``` # Buttons Provide a variety of button, including customizable sizes and types. ```astro --- import { ArrowRightIcon } from 'lucide-react'; ---
``` ## Presets Provides full support of [Presets](/docs/\[framework]/design/presets). ```astro
``` ## Sizes ```astro
``` ## Disabled When applied to a ` ``` ## Group ```tsx import { useState } from 'react'; export default function ButtonGroup() { const [active, setActive] = useState('january'); const months = ['january', 'february', 'march']; return ( ); } ``` ```svelte ``` # Cards Provides container elements that wrap and separate content. ```astro

Card

``` ```astro --- const imgSrc = 'https://images.unsplash.com/photo-1463171515643-952cee54d42a?q=80&w=450&h=190&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'; --- {/* Header */}
banner
{/* Article */}

Announcements

Skeleton is Awesome

Lorem ipsum dolor sit amet consectetur adipisicing elit. Numquam aspernatur provident eveniet eligendi cumque consequatur tempore sint nisi sapiente. Iste beatae laboriosam iure molestias cum expedita architecto itaque quae rem.

{/* Footer */}
By Alex On {new Date().toLocaleDateString()}
``` ## Presets Provides full support of [Presets](/docs/\[framework]/design/presets). ```astro
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
Card
``` # Chips Provides a robust set of interactive chip styles. ```astro --- import { CheckIcon } from 'lucide-react'; ---
``` ## Presets Provides full support of [Presets](/docs/\[framework]/design/presets). ```astro
``` ## Disabled When applied to a ` ``` ## Selection ```tsx import { useState } from 'react'; export default function Select() { const colors = ['red', 'blue', 'green']; const [color, setColor] = useState(colors[0]); return (
{/* Loop through the available colors */} {color && colors.map((c) => ( // On selection, set the color state, dynamically update classes ))}
); } ``` ```svelte
{#each colors as c (c)} {/each}
``` # Dividers Horizontal and vertical rule styling. ```astro

Above the divider.


Below the divider.

``` ## Size Use Tailwind's [border width](https://tailwindcss.com/docs/border-width) utilities to adjust thickness. ```astro
Default
border-t-2
border-t-4
border-t-8
``` ## Style Use Tailwind's [border style](https://tailwindcss.com/docs/border-style) utilities to adjust visual style. ```astro
border-solid
border-dashed
border-dotted
border-double
``` ## Colors Use any Tailwind or Skeleton [colors or pairing](/docs/\[framework]/design/colors). ```astro
border-primary-500
border-secondary-500
border-tertiary-500
border-success-500
border-warning-500
border-error-500
border-surface-950-50
``` ## Vertical Use `vr` for a vertical rule, which supports all above styles. Make sure to set the height. ```astro
Default border-l-8
``` # Forms and Inputs Various form and input styles. ```astro
``` ## Prerequisites ### Tailwind Forms Skeleton relies on the official [Tailwind Forms](https://github.com/tailwindlabs/tailwindcss-forms) plugin to normalize form styling. This plugin is if you wish to use any form utility classes provided on this page. To being, install the `@tailwindcss/forms` package. ```sh npm install -D @tailwindcss/forms ``` Then implement in your global stylesheet using the the `@plugin` directive. ```css @import 'tailwindcss'; @plugin '@tailwindcss/forms'; /* ...Skeleton config here... */ ``` ### Browser Support The quality and appearance of native and semantic HTML form elements can vary between both operating systems and browser vendors. Skeleton does its best to adhere to progressive enhancement best practices. However, we advise you validate support for each element per your target audience. ## Inputs Supports all [input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types), within reason. ```astro
``` ## Select ```astro
``` ## Checkboxes ```astro
``` ## Radio Groups ```astro
``` ## Kitchen Sink Display and functionality of these elements may vary greatly between devices and browsers. ```astro
``` ## Groups Input groups support a subset of form elements and button styles. These pair well with [Presets](/docs/\[framework]/design/presets). ```astro --- import { CheckIcon, CircleDollarSignIcon, SearchIcon } from 'lucide-react'; ---
https://
``` \| Class | Usage | \| ------------- | --------------------------------------- | \| `input-group` | Defines the parent input group set. | \| `ig-cell` | Defines a child cell for text or icons. | \| `ig-input` | Defines a child input of `type="text"`. | \| `ig-select` | Defines a child select element. | \| `ig-btn` | Defines a child button. | # Placeholders Provides "skeleton" placeholders that can display while content loads. ```astro
``` ## Animated ```html
...
``` # Tables Provides a set of styles for native HTML table elements. ```astro --- const tableData = [ { position: '0', name: 'Iron', symbol: 'Fe', atomic_no: '26' }, { position: '1', name: 'Rhodium', symbol: 'Rh', atomic_no: '45' }, { position: '2', name: 'Iodine', symbol: 'I', atomic_no: '53' }, { position: '3', name: 'Radon', symbol: 'Rn', atomic_no: '86' }, { position: '4', name: 'Technetium', symbol: 'Tc', atomic_no: '43' }, ]; ---
{ tableData.map((row) => ( )) }
{row.position} {row.symbol} {row.name} {row.atomic_no}
``` ## Extras Optionally add a header, footer, and caption. ```astro --- const tableData = [ { position: '0', name: 'Iron', symbol: 'Fe', atomic_no: '26' }, { position: '1', name: 'Rhodium', symbol: 'Rh', atomic_no: '45' }, { position: '2', name: 'Iodine', symbol: 'I', atomic_no: '53' }, { position: '3', name: 'Radon', symbol: 'Rn', atomic_no: '86' }, { position: '4', name: 'Technetium', symbol: 'Tc', atomic_no: '43' }, ]; ---
{ tableData.map((row) => ( )) }
A list of elements from the periodic table.
Position Symbol Name Weight
{row.position} {row.symbol} {row.name} {row.atomic_no}
Total {tableData.length} Elements
``` ## Navigation Native HTML tables do not support interaction. For accessibility, use anchors or buttons within the last cell. ```astro --- const tableData = [ { first: 'Liam', last: 'Steele', email: 'liam@email.com' }, { first: 'Athena', last: 'Marks', email: 'athena@email.com' }, { first: 'Angela', last: 'Rivers', email: 'angela@email.com' }, ]; ---
{ tableData.map((row) => ( )) }
First Name Last Name Email  
{row.first} {row.last} {row.email} View →
``` ## Layout See [Tailwind's utility classes](https://tailwindcss.com/docs/table-layout) for adjusting the table layout algorithm. Apply this to the Table element. ## Hover Rows Add a visual hover effect using the following Tailwind syntax. ```html ... ``` ## Pagination Pair with the Skeleton [Pagination](/docs/\[framework]/framework-components/pagination/) component for large data sets. # Accordion Divide content into collapsible sections. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; import { ChevronDownIcon } from 'lucide-react'; import { Fragment } from 'react'; export default function Default() { /** * Attribution * @see https://www.healthline.com/health/fun-facts-about-the-skeletal-system#8-More-than-half-your-bones-are-in-your-hands-and-feet */ const items = [ { id: '1', title: 'Your skeleton is made of more than 200 bones', description: 'Inside your body are 206 bones. Each bone plays a very important role in making all the mechanics of your body function properly. If a bone is broken, all the bones around it can’t perform their duty properly.', }, { id: '2', title: 'The smallest bone in the body is in your ear', description: 'The stapes, a bone in your inner ear, is the smallest of all your bones. This bone is also sometimes called the stirrup because of its Y shape. Together with the anvil and hammer bones, the stapes helps translate sounds you hear into waves your brain can understand.', }, { id: '3', title: 'One bone isn’t connected to any other bones', description: 'The hyoid bone, which is in your throat, is the only bone that doesn’t connect to a joint. The hyoid is responsible for holding your tongue in place.', }, ]; return ( {items.map((item, i) => ( {i !== 0 &&
}

{item.title}

{item.description}
))}
); } ``` ```svelte {#each items as item, i (item)} {#if i !== 0}
{/if}

{item.title}

{#snippet element(attributes)} {#if !attributes.hidden}
{item.description}
{/if} {/snippet}
{/each}
``` ## Controlled Use the `open` and `onOpenChange` props to control the state. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Controlled() { const [value, setValue] = useState(['1']); return ( setValue(details.value)}> {['1', '2', '3'].map((item) => (

Item {item}

Content for item {item}
))}
); } ``` ```svelte (value = details.value)}> {#each ['1', '2', '3'] as item (item)}

Item {item}

Content for item {item}
{/each}
``` ## Multiple Allow multiple accordion items to stay open at once using the `multiple` prop. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; // [!code highlight] export default function Multiple() { return ( {['1', '2', '3'].map((item) => (

Item {item}

Content for item {item}
))}
); } ``` ```svelte {#each ['1', '2', '3'] as item (item)}

Item {item}

Content for item {item}
{/each}
``` ## Collapsible Allow closing all items when one is open using the `collapsible` prop. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; export default function Collapsible() { return ( {['1', '2', '3'].map((item) => (

Item {item}

Content for item {item}
))}
); } ``` ```svelte {#each ['1', '2', '3'] as item (item)}

Item {item}

Content for item {item}
{/each}
``` ## Indicator Add a custom indicator to accordion triggers. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; import { MinusIcon, PlusIcon } from 'lucide-react'; export default function Indicator() { return ( {['1', '2', '3'].map((item) => (

Item {item}

Content for item {item}
))}
); } ``` ```svelte {#each ['1', '2', '3'] as item (item)}

Item {item}

Content for item {item}
{/each}
``` ## Orientation Render the accordion vertically or horizontally using the `orientation` prop. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; export default function Orientation() { return ( {['1', '2', '3'].map((item) => (

Item {item}

Content for item {item}
))}
); } ``` ```svelte {#each ['1', '2', '3'] as item (item)}

Item {item}

Content for item {item}
{/each}
``` ## Dir Set the text direction (`ltr` or `rtl`) using the `dir` prop. ```tsx import { Accordion } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( {['1', '2', '3'].map((item) => (

Item {item}

Content for item {item}
))}
); } ``` ```svelte {#each ['1', '2', '3'] as item (item)}

Item {item}

Content for item {item}
{/each}
``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | ids | The ids of the elements in the accordion. Useful for composition. | Partial\<\{ root: string; item: (value: string) => string; itemContent: (value: string) => string; itemTrigger: (value: string) => string; }> \| undefined | - | | multiple | Whether multiple accordion items can be expanded at the same time. | boolean \| undefined | false | | collapsible | Whether an accordion item can be closed after it has been expanded. | boolean \| undefined | false | | value | The controlled value of the expanded accordion items. | string\[] \| undefined | - | | defaultValue | The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion. | string\[] \| undefined | - | | disabled | Whether the accordion items are disabled | boolean \| undefined | - | | onValueChange | The callback fired when the state of expanded/collapsed accordion items changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | The callback fired when the focused accordion item changes. | ((details: FocusChangeDetails) => void) \| undefined | - | | orientation | The orientation of the accordion items. | "horizontal" \| "vertical" \| undefined | "vertical" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | AccordionApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------------- | ------- | | children | - | (accordion: AccordionApi\) => ReactNode | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------------------- | -------------------------------------------------------------- | ------- | | value | The value of the accordion item. | string | - | | disabled | Whether the accordion item is disabled. | boolean \| undefined | - | | children | - | ReactNode | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemTrigger | Prop | Description | Type | Default | | -------- | --------------------------- | ----------------------------------------------------------------- | ------- | | children | - | ReactNode | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### ItemIndicator | Prop | Description | Type | Default | | -------- | --------------------------- | -------------------------------------------------------------- | ------- | | children | - | ReactNode | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemContent | Prop | Description | Type | Default | | -------- | --------------------------- | -------------------------------------------------------------- | ------- | | children | - | ReactNode | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | ids | The ids of the elements in the accordion. Useful for composition. | Partial\<\{ root: string; item: (value: string) => string; itemContent: (value: string) => string; itemTrigger: (value: string) => string; }> \| undefined | - | | multiple | Whether multiple accordion items can be expanded at the same time. | boolean \| undefined | false | | collapsible | Whether an accordion item can be closed after it has been expanded. | boolean \| undefined | false | | value | The controlled value of the expanded accordion items. | string\[] \| undefined | - | | defaultValue | The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion. | string\[] \| undefined | - | | disabled | Whether the accordion items are disabled | boolean \| undefined | - | | onValueChange | The callback fired when the state of expanded/collapsed accordion items changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | The callback fired when the focused accordion item changes. | ((details: FocusChangeDetails) => void) \| undefined | - | | orientation | The orientation of the accordion items. | "horizontal" \| "vertical" \| undefined | "vertical" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => AccordionApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------- | ------- | | children | - | Snippet\<\[() => AccordionApi\]> | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------------------- | ------------------------------------------------ | ------- | | value | The value of the accordion item. | string | - | | disabled | Whether the accordion item is disabled. | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### ItemIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemContent | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # App Bar A header element for the top of your page layout. ```tsx import { AppBar } from '@skeletonlabs/skeleton-react'; import { CalendarIcon } from 'lucide-react'; import { CircleUserIcon } from 'lucide-react'; import { MenuIcon } from 'lucide-react'; import { SearchIcon } from 'lucide-react'; export default function Default() { return (

Skeleton

); } ``` ```svelte

Skeleton

``` ## Centered Control the layout using a [grid-cols-\*](https://tailwindcss.com/docs/grid-column) utility class. ```tsx import { AppBar } from '@skeletonlabs/skeleton-react'; import { CalendarIcon } from 'lucide-react'; import { CircleUserIcon } from 'lucide-react'; import { MenuIcon } from 'lucide-react'; import { SearchIcon } from 'lucide-react'; export default function Centered() { return (

Headline

); } ``` ```svelte

Headline

``` ## Extended Move the `` to a new row within the root. ```tsx import { AppBar } from '@skeletonlabs/skeleton-react'; import { CalendarIcon } from 'lucide-react'; import { CircleUserIcon } from 'lucide-react'; import { MenuIcon } from 'lucide-react'; import { SearchIcon } from 'lucide-react'; export default function Extended() { return (

Headline

); } ``` ```svelte

Headline

``` ## Responsive ```tsx import { AppBar } from '@skeletonlabs/skeleton-react'; import { CalendarIcon } from 'lucide-react'; import { CircleUserIcon } from 'lucide-react'; import { MenuIcon } from 'lucide-react'; import { SearchIcon } from 'lucide-react'; export default function Responsive() { return ( <> {/* 1. Set dynamic spacing */} {/* 2. Set dynamic layout columns */} {/* 3. Set Mobile display */}

Headline

{/* 4. Set Desktop display */}

Headline

); } ``` ```svelte

Headline

``` ## API Reference ### Root | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"header">) => Element) \| undefined | - | ### Toolbar | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Lead | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"nav">) => Element) \| undefined | - | ### Headline | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Trail | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"nav">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"header">]> \| undefined | - | ### Toolbar | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Lead | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"nav">]> \| undefined | - | ### Headline | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Trail | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"nav">]> \| undefined | - | # Avatar An image with a fallback for representing the user. ```tsx import { Avatar } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( SK ); } ``` ```svelte SK ``` ## Fallback Use a fallback when an image fails to load or is unavailable. ```tsx import { Avatar } from '@skeletonlabs/skeleton-react'; export default function Fallback() { return ( SK ); } ``` ```svelte SK ``` ## Filter Apply [SVG Filters](/docs/\[framework]/guides/cookbook/svg-filters) to avatar images. ```tsx import { Avatar } from '@skeletonlabs/skeleton-react'; export default function Filter() { return ( <> SK ); } ``` ```svelte SK ``` ## API Reference ### Root | Prop | Description | Type | Default | | -------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | ------- | | onStatusChange | Functional called when the image loading status changes. | ((details: StatusChangeDetails) => void) \| undefined | - | | ids | The ids of the elements in the avatar. Useful for composition. | Partial\<\{ root: string; image: string; fallback: string; }> \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | AvatarApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | (avatar: AvatarApi\) => ReactNode | - | ### Image | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"img">) => Element) \| undefined | - | ### Fallback | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | -------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | ------- | | onStatusChange | Functional called when the image loading status changes. | ((details: StatusChangeDetails) => void) \| undefined | - | | ids | The ids of the elements in the avatar. Useful for composition. | Partial\<\{ root: string; image: string; fallback: string; }> \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => AvatarApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------- | ------- | | children | - | Snippet\<\[() => AvatarApi\]> | - | ### Image | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"img">]> \| undefined | - | ### Fallback | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | # Collapsible A container that can be expanded or collapsed to show or hide content. ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Toggle Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ```svelte Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ``` ## Controlled ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Controlled() { const [open, setOpen] = useState(false); return ( setOpen(details.open)}> {open ? 'Close' : 'Open'} Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ```svelte (open = details.open)}> {open ? 'Close' : 'Open'} Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ``` ## Indicator ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; import { MinusIcon, PlusIcon } from 'lucide-react'; export default function Default() { return ( Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ); } ``` ```svelte Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ``` ## Disabled ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Disabled() { return ( Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quas maxime in praesentium reiciendis eveniet modi mollitia? Odio accusantium veritatis accusamus quia placeat sapiente reiciendis? Consectetur, quis! Voluptatem omnis accusantium blanditiis. ); } ``` ```svelte Toggle Lorem, ipsum dolor sit amet consectetur adipisicing elit. Repellendus ea reiciendis veritatis quae mollitia, nulla minima cupiditate quisquam soluta sunt? Necessitatibus non dolorum voluptas ea maiores itaque laborum officiis quia. ``` ## Alignment ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Alignment() { return ( Toggle Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ```svelte Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ``` ## Direction ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Toggle Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ```svelte Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ``` ## API Reference ### Root | Prop | Description | Type | Default | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the collapsible. Useful for composition. | Partial\<\{ root: string; content: string; trigger: string; }> \| undefined | - | | open | The controlled open state of the collapsible. | boolean \| undefined | - | | defaultOpen | The initial open state of the collapsible when rendered. Use when you don't need to control the open state of the collapsible. | boolean \| undefined | - | | onOpenChange | The callback invoked when the open state changes. | ((details: OpenChangeDetails) => void) \| undefined | - | | onExitComplete | The callback invoked when the exit animation completes. | VoidFunction \| undefined | - | | disabled | Whether the collapsible is disabled. | boolean \| undefined | - | | collapsedHeight | The height of the content when collapsed. | string \| number \| undefined | - | | collapsedWidth | The width of the content when collapsed. | string \| number \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | CollapsibleApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------------------ | ------- | | children | - | (collapsible: CollapsibleApi\) => ReactNode | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Indicator | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the collapsible. Useful for composition. | Partial\<\{ root: string; content: string; trigger: string; }> \| undefined | - | | open | The controlled open state of the collapsible. | boolean \| undefined | - | | defaultOpen | The initial open state of the collapsible when rendered. Use when you don't need to control the open state of the collapsible. | boolean \| undefined | - | | onOpenChange | The callback invoked when the open state changes. | ((details: OpenChangeDetails) => void) \| undefined | - | | onExitComplete | The callback invoked when the exit animation completes. | VoidFunction \| undefined | - | | disabled | Whether the collapsible is disabled. | boolean \| undefined | - | | collapsedHeight | The height of the content when collapsed. | string \| number \| undefined | - | | collapsedWidth | The width of the content when collapsed. | string \| number \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => CollapsibleApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | --------------------------------------------- | ------- | | children | - | Snippet\<\[() => CollapsibleApi\]> | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Indicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Combobox A combobox is an input widget with an associated popup that enables users to select a value from a collection of possible values. ```svelte Label {#each items as item (item.value)} {item.label} {/each} ``` ```tsx import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Default() { const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const filtered = data.filter((item) => item.value.toLowerCase().includes(event.inputValue.toLowerCase())); if (filtered.length > 0) { setItems(filtered); } else { setItems(data); } }; return ( Label {items.map((item) => ( {item.label} ))} ); } ``` ## Groups Create labelled groups for your items. ```svelte {#each collection.group() as [type, items] (type)} {type} {#each items as item (item.value)} {item.label} {/each} {/each} ``` ```tsx 'use client'; import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple', type: 'Fruits' }, { label: 'Banana', value: 'banana', type: 'Fruits' }, { label: 'Orange', value: 'orange', type: 'Fruits' }, { label: 'Carrot', value: 'carrot', type: 'Vegetables' }, { label: 'Broccoli', value: 'broccoli', type: 'Vegetables' }, { label: 'Spinach', value: 'spinach', type: 'Vegetables' }, ]; export default function Group() { const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, groupBy: (item) => item.type, }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const filtered = data.filter((item) => item.value.toLowerCase().includes(event.inputValue.toLowerCase())); if (filtered.length > 0) { setItems(filtered); } else { setItems(data); } }; return ( {collection.group().map(([type, items]) => ( {type} {items.map((item) => ( {item.label} ))} ))} ); } ``` ## Auto Highlight Search for any option, then tap Enter on your keyboard to automatically select it. ```svelte {#each items as item (item.value)} {item.label} {/each} ``` ```tsx import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function AutoHighlight() { const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const filtered = data.filter((item) => item.value.toLowerCase().includes(event.inputValue.toLowerCase())); if (filtered.length > 0) { setItems(filtered); } else { setItems(data); } }; return ( {items.map((item) => ( {item.label} ))} ); } ``` ## Multiple To maintain filtering functionality and improve clarity for users, we recommend displaying each selected value outside the perimeter of the Combobox component. ```svelte
{#each items as item (item.value)} {item.label} {/each}
{#each value as item (item)} {item} {/each}
``` ```tsx import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Default() { const [value, setValue] = useState([]); const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const filtered = data.filter((item) => item.value.toLowerCase().includes(event.inputValue.toLowerCase())); if (filtered.length > 0) { setItems(filtered); } else { setItems(data); } }; const onValueChange: ComboboxRootProps['onValueChange'] = (event) => { setValue(event.value); }; return (
{items.map((item) => ( {item.label} ))}
{value.map((item) => ( {item} ))}
); } ``` ## Disabled Item ```svelte {#each items as item (item.value)} {item.label} {/each} ``` ```tsx import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Default() { const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, isItemDisabled: (item) => item.value === 'banana', }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const filtered = data.filter((item) => item.value.toLowerCase().includes(event.inputValue.toLowerCase())); if (filtered.length > 0) { setItems(filtered); } else { setItems(data); } }; return ( {items.map((item) => ( {item.label} ))} ); } ``` ## Custom Filter Try mistyping `apple` or `banana` to see the custom filter using the fuzzy search from [Fuse.js](https://fusejs.io/) in action. ```svelte {#each items as item (item.value)} {item.label} {/each} ``` ```tsx import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import Fuse from 'fuse.js'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; const fuse = new Fuse(data, { keys: ['label', 'value'], threshold: 0.3, }); export default function Default() { const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const results = fuse.search(event.inputValue); if (results.length > 0) { setItems(results.map((result) => result.item)); } else { setItems(data); } }; return ( {items.map((item) => ( {item.label} ))} ); } ``` ## Direction ```svelte Label {#each items as item (item.value)} {item.label} {/each} ``` ```tsx import { Combobox, Portal, type ComboboxRootProps, useListCollection } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Dir() { const [items, setItems] = useState(data); const collection = useListCollection({ items: items, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); const onOpenChange = () => { setItems(data); }; const onInputValueChange: ComboboxRootProps['onInputValueChange'] = (event) => { const filtered = data.filter((item) => item.value.toLowerCase().includes(event.inputValue.toLowerCase())); if (filtered.length > 0) { setItems(filtered); } else { setItems(data); } }; return ( Label {items.map((item) => ( {item.label} ))} ); } ``` ## Guidelines ### Z-Index By default we do not take an opinionated stance regarding z-index stacking. The result is the component can sometimes be occluded beneath other elements with a higher index. The Z-Index can controlled by applying a utility class to the Positioner component part. ```astro ``` ### Max Items We recommend no more than 500 items max. For normal usage, a few dozen will provide the best performance. ## API Reference ### Root | Prop | Description | Type | Default | | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ | | open | The controlled open state of the combobox | boolean \| undefined | - | | defaultOpen | The initial open state of the combobox when rendered. Use when you don't need to control the open state of the combobox. | boolean \| undefined | - | | ids | The ids of the elements in the combobox. Useful for composition. | Partial\<\{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item: (id: string, index?: number \| undefined) => string; positioner: string; itemGroup: (id: string \| number) => string; itemGroupLabel: (id: string \| number) => string; }> \| undefined | - | | inputValue | The controlled value of the combobox's input | string \| undefined | - | | defaultInputValue | The initial value of the combobox's input when rendered. Use when you don't need to control the value of the combobox's input. | string \| undefined | "" | | name | The \`name\` attribute of the combobox's input. Useful for form submission | string \| undefined | - | | form | The associate form of the combobox. | string \| undefined | - | | disabled | Whether the combobox is disabled | boolean \| undefined | - | | readOnly | Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it | boolean \| undefined | - | | invalid | Whether the combobox is invalid | boolean \| undefined | - | | required | Whether the combobox is required | boolean \| undefined | - | | placeholder | The placeholder text of the combobox's input | string \| undefined | - | | defaultHighlightedValue | The initial highlighted value of the combobox when rendered. Use when you don't need to control the highlighted value of the combobox. | string \| null \| undefined | - | | highlightedValue | The controlled highlighted value of the combobox | string \| null \| undefined | - | | value | The controlled value of the combobox's selected items | string\[] \| undefined | - | | defaultValue | The initial value of the combobox's selected items when rendered. Use when you don't need to control the value of the combobox's selected items. | string\[] \| undefined | \[] | | inputBehavior | Defines the auto-completion behavior of the combobox. - \`autohighlight\`: The first focused item is highlighted as the user types - \`autocomplete\`: Navigating the listbox with the arrow keys selects the item and the input is updated | "autohighlight" \| "autocomplete" \| "none" \| undefined | "none" | | selectionBehavior | The behavior of the combobox input when an item is selected - \`replace\`: The selected item string is set as the input value - \`clear\`: The input value is cleared - \`preserve\`: The input value is preserved | "clear" \| "replace" \| "preserve" \| undefined | "replace" | | autoFocus | Whether to autofocus the input on mount | boolean \| undefined | - | | openOnClick | Whether to open the combobox popup on initial click on the input | boolean \| undefined | false | | openOnChange | Whether to show the combobox when the input value changes | boolean \| ((details: InputValueChangeDetails) => boolean) \| undefined | true | | allowCustomValue | Whether to allow typing custom values in the input | boolean \| undefined | - | | alwaysSubmitOnEnter | Whether to always submit on Enter key press, even if popup is open. Useful for single-field autocomplete forms where Enter should submit the form. | boolean \| undefined | false | | loopFocus | Whether to loop the keyboard navigation through the items | boolean \| undefined | true | | positioning | The positioning options to dynamically position the menu | PositioningOptions \| undefined | \{ placement: "bottom-start" } | | onInputValueChange | Function called when the input's value changes | ((details: InputValueChangeDetails) => void) \| undefined | - | | onValueChange | Function called when a new item is selected | ((details: ValueChangeDetails\) => void) \| undefined | - | | onHighlightChange | Function called when an item is highlighted using the pointer or keyboard navigation. | ((details: HighlightChangeDetails\) => void) \| undefined | - | | onSelect | Function called when an item is selected | ((details: SelectionDetails) => void) \| undefined | - | | onOpenChange | Function called when the popup is opened | ((details: OpenChangeDetails) => void) \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | collection | The collection of items | ListCollection\ \| undefined | - | | multiple | Whether to allow multiple selection. \*\*Good to know:\*\* When \`multiple\` is \`true\`, the \`selectionBehavior\` is automatically set to \`clear\`. It is recommended to render the selected items in a separate container. | boolean \| undefined | - | | closeOnSelect | Whether to close the combobox when an item is selected. | boolean \| undefined | - | | openOnKeyPress | Whether to open the combobox on arrow key press | boolean \| undefined | true | | scrollToIndexFn | Function to scroll to a specific index | ((details: ScrollToIndexDetails) => void) \| undefined | - | | composite | Whether the combobox is a composed with other composite widgets like tabs | boolean \| undefined | true | | disableLayer | Whether to disable registering this a dismissable layer | boolean \| undefined | - | | navigate | Function to navigate to the selected item | ((details: NavigateDetails) => void) \| null \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | ComboboxApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------------------- | ------- | | children | - | (combobox: ComboboxApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Input | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"ul">) => Element) \| undefined | - | ### ItemGroup | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemGroupLabel | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | ------------ | ----------------------------------------------------------- | ------------------------------------------------------------- | ------- | | persistFocus | Whether hovering outside should clear the highlighted state | boolean \| undefined | - | | item | The item to render | any | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"li">) => Element) \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### ItemIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ | | open | The controlled open state of the combobox | boolean \| undefined | - | | defaultOpen | The initial open state of the combobox when rendered. Use when you don't need to control the open state of the combobox. | boolean \| undefined | - | | ids | The ids of the elements in the combobox. Useful for composition. | Partial\<\{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item: (id: string, index?: number \| undefined) => string; positioner: string; itemGroup: (id: string \| number) => string; itemGroupLabel: (id: string \| number) => string; }> \| undefined | - | | inputValue | The controlled value of the combobox's input | string \| undefined | - | | defaultInputValue | The initial value of the combobox's input when rendered. Use when you don't need to control the value of the combobox's input. | string \| undefined | "" | | name | The \`name\` attribute of the combobox's input. Useful for form submission | string \| undefined | - | | form | The associate form of the combobox. | string \| undefined | - | | disabled | Whether the combobox is disabled | boolean \| undefined | - | | readOnly | Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it | boolean \| undefined | - | | invalid | Whether the combobox is invalid | boolean \| undefined | - | | required | Whether the combobox is required | boolean \| undefined | - | | placeholder | The placeholder text of the combobox's input | string \| undefined | - | | defaultHighlightedValue | The initial highlighted value of the combobox when rendered. Use when you don't need to control the highlighted value of the combobox. | string \| null \| undefined | - | | highlightedValue | The controlled highlighted value of the combobox | string \| null \| undefined | - | | value | The controlled value of the combobox's selected items | string\[] \| undefined | - | | defaultValue | The initial value of the combobox's selected items when rendered. Use when you don't need to control the value of the combobox's selected items. | string\[] \| undefined | \[] | | inputBehavior | Defines the auto-completion behavior of the combobox. - \`autohighlight\`: The first focused item is highlighted as the user types - \`autocomplete\`: Navigating the listbox with the arrow keys selects the item and the input is updated | "autohighlight" \| "autocomplete" \| "none" \| undefined | "none" | | selectionBehavior | The behavior of the combobox input when an item is selected - \`replace\`: The selected item string is set as the input value - \`clear\`: The input value is cleared - \`preserve\`: The input value is preserved | "clear" \| "replace" \| "preserve" \| undefined | "replace" | | autoFocus | Whether to autofocus the input on mount | boolean \| undefined | - | | openOnClick | Whether to open the combobox popup on initial click on the input | boolean \| undefined | false | | openOnChange | Whether to show the combobox when the input value changes | boolean \| ((details: InputValueChangeDetails) => boolean) \| undefined | true | | allowCustomValue | Whether to allow typing custom values in the input | boolean \| undefined | - | | alwaysSubmitOnEnter | Whether to always submit on Enter key press, even if popup is open. Useful for single-field autocomplete forms where Enter should submit the form. | boolean \| undefined | false | | loopFocus | Whether to loop the keyboard navigation through the items | boolean \| undefined | true | | positioning | The positioning options to dynamically position the menu | PositioningOptions \| undefined | \{ placement: "bottom-start" } | | onInputValueChange | Function called when the input's value changes | ((details: InputValueChangeDetails) => void) \| undefined | - | | onValueChange | Function called when a new item is selected | ((details: ValueChangeDetails\) => void) \| undefined | - | | onHighlightChange | Function called when an item is highlighted using the pointer or keyboard navigation. | ((details: HighlightChangeDetails\) => void) \| undefined | - | | onSelect | Function called when an item is selected | ((details: SelectionDetails) => void) \| undefined | - | | onOpenChange | Function called when the popup is opened | ((details: OpenChangeDetails) => void) \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | collection | The collection of items | ListCollection\ \| undefined | - | | multiple | Whether to allow multiple selection. \*\*Good to know:\*\* When \`multiple\` is \`true\`, the \`selectionBehavior\` is automatically set to \`clear\`. It is recommended to render the selected items in a separate container. | boolean \| undefined | - | | closeOnSelect | Whether to close the combobox when an item is selected. | boolean \| undefined | - | | openOnKeyPress | Whether to open the combobox on arrow key press | boolean \| undefined | true | | scrollToIndexFn | Function to scroll to a specific index | ((details: ScrollToIndexDetails) => void) \| undefined | - | | composite | Whether the combobox is a composed with other composite widgets like tabs | boolean \| undefined | true | | disableLayer | Whether to disable registering this a dismissable layer | boolean \| undefined | - | | navigate | Function to navigate to the selected item | ((details: NavigateDetails) => void) \| null \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => ComboboxApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------------- | ------- | | children | - | Snippet\<\[() => ComboboxApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Input | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"ul">]> \| undefined | - | ### ItemGroup | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemGroupLabel | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | ------------ | ----------------------------------------------------------- | ----------------------------------------------- | ------- | | persistFocus | Whether hovering outside should clear the highlighted state | boolean \| undefined | - | | item | The item to render | any | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"li">]> \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### ItemIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Date Picker Select dates from a calendar interface. ```tsx import { DatePicker, Portal } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte Label {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## Controlled Manage the selected date value with controlled state. ```tsx import { DatePicker, parseDate, Portal } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Controlled() { const [value, setValue] = useState([parseDate('2025-10-15')]); return ( setValue(e.value)}> Picked date: {value.at(0)?.toString()} {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte (value = e.value)}> Picked date: {value.at(0)?.toString()} {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## Disabled Disable the date picker to prevent user interaction. ```tsx import { DatePicker, Portal } from '@skeletonlabs/skeleton-react'; export default function Disabled() { return ( Label {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte Label {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## Minimum and Maximum Restrict date selection to a specific range using the `min` and `max` props with the `parseDate` helper function. ```tsx import { DatePicker, parseDate, Portal } from '@skeletonlabs/skeleton-react'; export default function MinMax() { return ( Label {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte Label {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## Range Selection Enable range selection by setting `selectionMode="range"` on the root component. Pair with two inputs fields: * `index={0}` to represent the start dates. * `index={1}` to represent the end dates. ```tsx import { DatePicker, Portal } from '@skeletonlabs/skeleton-react'; export default function Range() { return ( Select Date Range {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte Select Date Range {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## Inline calendar Display the calendar inline without a popover by adding the `inline` prop to the root component. When using inline mode, omit the `Portal` and `Positioner` components. ```tsx import { DatePicker } from '@skeletonlabs/skeleton-react'; export default function Inline() { return ( Label {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte Label {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## Month and Year Selection Add `MonthSelect` and `YearSelect` components to provide selectors for quickly changing the month and year. ```tsx import { DatePicker, Portal } from '@skeletonlabs/skeleton-react'; export default function WithSelects() { return ( Label {(datePicker) => ( <> {datePicker.weekDays.map((weekDay, id) => ( {weekDay.short} ))} {datePicker.weeks.map((week, id) => ( {week.map((day, id) => ( {day.day} ))} ))} )} {(datePicker) => ( <> {datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => ( {months.map((month, id) => ( {month.label} ))} ))} )} {(datePicker) => ( <> {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => ( {years.map((year, id) => ( {year.label} ))} ))} )} ); } ``` ```svelte Label {#snippet children(datePicker)} {#each datePicker().weekDays as weekDay, id (id)} {weekDay.short} {/each} {#each datePicker().weeks as week, id (id)} {#each week as day, id (id)} {day.day} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getMonthsGrid({ columns: 4, format: 'short' }) as months, id (id)} {#each months as month, id (id)} {month.label} {/each} {/each} {/snippet} {#snippet children(datePicker)} {#each datePicker().getYearsGrid({ columns: 4 }) as years, id (id)} {#each years as year, id (id)} {year.label} {/each} {/each} {/snippet} ``` ## API Reference ### Root | Prop | Description | Type | Default | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | locale | The locale (BCP 47 language tag) to use when formatting the date. | string \| undefined | "en-US" | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | ids | The ids of the elements in the date picker. Useful for composition. | Partial\<\{ root: string; label: (index: number) => string; table: (id: string) => string; tableHeader: (id: string) => string; tableBody: (id: string) => string; tableRow: (id: string) => string; ... 11 more ...; positioner: string; }> \| undefined | - | | name | The \`name\` attribute of the input element. | string \| undefined | - | | timeZone | The time zone to use | string \| undefined | "UTC" | | disabled | Whether the calendar is disabled. | boolean \| undefined | - | | readOnly | Whether the calendar is read-only. | boolean \| undefined | - | | outsideDaySelectable | Whether day outside the visible range can be selected. | boolean \| undefined | false | | min | The minimum date that can be selected. | DateValue \| undefined | - | | max | The maximum date that can be selected. | DateValue \| undefined | - | | closeOnSelect | Whether the calendar should close after the date selection is complete. This is ignored when the selection mode is \`multiple\`. | boolean \| undefined | true | | value | The controlled selected date(s). | DateValue\[] \| undefined | - | | defaultValue | The initial selected date(s) when rendered. Use when you don't need to control the selected date(s) of the date picker. | DateValue\[] \| undefined | - | | focusedValue | The controlled focused date. | DateValue \| undefined | - | | defaultFocusedValue | The initial focused date when rendered. Use when you don't need to control the focused date of the date picker. | DateValue \| undefined | - | | numOfMonths | The number of months to display. | number \| undefined | - | | startOfWeek | The first day of the week. \`0\` - Sunday \`1\` - Monday \`2\` - Tuesday \`3\` - Wednesday \`4\` - Thursday \`5\` - Friday \`6\` - Saturday | number \| undefined | - | | fixedWeeks | Whether the calendar should have a fixed number of weeks. This renders the calendar with 6 weeks instead of 5 or 6. | boolean \| undefined | - | | onValueChange | Function called when the value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | Function called when the focused date changes. | ((details: FocusChangeDetails) => void) \| undefined | - | | onViewChange | Function called when the view changes. | ((details: ViewChangeDetails) => void) \| undefined | - | | onOpenChange | Function called when the calendar opens or closes. | ((details: OpenChangeDetails) => void) \| undefined | - | | isDateUnavailable | Returns whether a date of the calendar is available. | ((date: DateValue, locale: string) => boolean) \| undefined | - | | selectionMode | The selection mode of the calendar. - \`single\` - only one date can be selected - \`multiple\` - multiple dates can be selected - \`range\` - a range of dates can be selected | SelectionMode \| undefined | "single" | | format | The format of the date to display in the input. | ((date: DateValue, details: LocaleDetails) => string) \| undefined | - | | parse | Function to parse the date from the input back to a DateValue. | ((value: string, details: LocaleDetails) => DateValue \| undefined) \| undefined | - | | placeholder | The placeholder text to display in the input. | string \| undefined | - | | view | The view of the calendar | DateView \| undefined | - | | defaultView | The default view of the calendar | DateView \| undefined | "day" | | minView | The minimum view of the calendar | DateView \| undefined | "day" | | maxView | The maximum view of the calendar | DateView \| undefined | "year" | | positioning | The user provided options used to position the date picker content | PositioningOptions \| undefined | - | | open | The controlled open state of the date picker | boolean \| undefined | - | | defaultOpen | The initial open state of the date picker when rendered. Use when you don't need to control the open state of the date picker. | boolean \| undefined | - | | inline | Whether to render the date picker inline | boolean \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | DatePickerApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------------- | ------- | | children | - | (datePicker: DatePickerApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### PresetTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | value | - | PresetTriggerValue | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Input | Prop | Description | Type | Default | | --------- | --------------------------------------- | ---------------------------------------------------------------- | ------- | | index | The index of the input to focus. | number \| undefined | - | | fixOnBlur | Whether to fix the input value on blur. | boolean \| undefined | true | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### YearSelect | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"select">) => Element) \| undefined | - | ### MonthSelect | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"select">) => Element) \| undefined | - | ### View | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | view | - | DateView \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ViewControl | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### PrevTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### ViewTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### RangeText | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### NextTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Table | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"table">) => Element) \| undefined | - | ### TableHead | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"thead">) => Element) \| undefined | - | ### TableRow | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"tr">) => Element) \| undefined | - | ### TableHeader | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"th">) => Element) \| undefined | - | ### TableBody | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"tbody">) => Element) \| undefined | - | ### TableCell | Prop | Description | Type | Default | | ------------ | --------------------------- | ------------------------------------------------------------- | ------- | | disabled | - | boolean \| undefined | - | | value | - | number \| DateValue | - | | columns | - | number \| undefined | - | | visibleRange | - | VisibleRange \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"td">) => Element) \| undefined | - | ### TableCellTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | locale | The locale (BCP 47 language tag) to use when formatting the date. | string \| undefined | "en-US" | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | ids | The ids of the elements in the date picker. Useful for composition. | Partial\<\{ root: string; label: (index: number) => string; table: (id: string) => string; tableHeader: (id: string) => string; tableBody: (id: string) => string; tableRow: (id: string) => string; ... 11 more ...; positioner: string; }> \| undefined | - | | name | The \`name\` attribute of the input element. | string \| undefined | - | | timeZone | The time zone to use | string \| undefined | "UTC" | | disabled | Whether the calendar is disabled. | boolean \| undefined | - | | readOnly | Whether the calendar is read-only. | boolean \| undefined | - | | outsideDaySelectable | Whether day outside the visible range can be selected. | boolean \| undefined | false | | min | The minimum date that can be selected. | DateValue \| undefined | - | | max | The maximum date that can be selected. | DateValue \| undefined | - | | closeOnSelect | Whether the calendar should close after the date selection is complete. This is ignored when the selection mode is \`multiple\`. | boolean \| undefined | true | | value | The controlled selected date(s). | DateValue\[] \| undefined | - | | defaultValue | The initial selected date(s) when rendered. Use when you don't need to control the selected date(s) of the date picker. | DateValue\[] \| undefined | - | | focusedValue | The controlled focused date. | DateValue \| undefined | - | | defaultFocusedValue | The initial focused date when rendered. Use when you don't need to control the focused date of the date picker. | DateValue \| undefined | - | | numOfMonths | The number of months to display. | number \| undefined | - | | startOfWeek | The first day of the week. \`0\` - Sunday \`1\` - Monday \`2\` - Tuesday \`3\` - Wednesday \`4\` - Thursday \`5\` - Friday \`6\` - Saturday | number \| undefined | - | | fixedWeeks | Whether the calendar should have a fixed number of weeks. This renders the calendar with 6 weeks instead of 5 or 6. | boolean \| undefined | - | | onValueChange | Function called when the value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | Function called when the focused date changes. | ((details: FocusChangeDetails) => void) \| undefined | - | | onViewChange | Function called when the view changes. | ((details: ViewChangeDetails) => void) \| undefined | - | | onOpenChange | Function called when the calendar opens or closes. | ((details: OpenChangeDetails) => void) \| undefined | - | | isDateUnavailable | Returns whether a date of the calendar is available. | ((date: DateValue, locale: string) => boolean) \| undefined | - | | selectionMode | The selection mode of the calendar. - \`single\` - only one date can be selected - \`multiple\` - multiple dates can be selected - \`range\` - a range of dates can be selected | SelectionMode \| undefined | "single" | | format | The format of the date to display in the input. | ((date: DateValue, details: LocaleDetails) => string) \| undefined | - | | parse | Function to parse the date from the input back to a DateValue. | ((value: string, details: LocaleDetails) => DateValue \| undefined) \| undefined | - | | placeholder | The placeholder text to display in the input. | string \| undefined | - | | view | The view of the calendar | DateView \| undefined | - | | defaultView | The default view of the calendar | DateView \| undefined | "day" | | minView | The minimum view of the calendar | DateView \| undefined | "day" | | maxView | The maximum view of the calendar | DateView \| undefined | "year" | | positioning | The user provided options used to position the date picker content | PositioningOptions \| undefined | - | | open | The controlled open state of the date picker | boolean \| undefined | - | | defaultOpen | The initial open state of the date picker when rendered. Use when you don't need to control the open state of the date picker. | boolean \| undefined | - | | inline | Whether to render the date picker inline | boolean \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => DatePickerApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | Snippet\<\[() => DatePickerApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### PresetTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | value | - | PresetTriggerValue | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Input | Prop | Description | Type | Default | | --------- | --------------------------------------- | -------------------------------------------------- | ------- | | index | The index of the input to focus. | number \| undefined | - | | fixOnBlur | Whether to fix the input value on blur. | boolean \| undefined | true | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### YearSelect | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"select">]> \| undefined | - | ### MonthSelect | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"select">]> \| undefined | - | ### View | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | view | - | DateView \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ViewControl | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### PrevTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### ViewTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### RangeText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### NextTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Table | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"table">]> \| undefined | - | ### TableHead | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"thead">]> \| undefined | - | ### TableRow | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"tr">]> \| undefined | - | ### TableHeader | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"th">]> \| undefined | - | ### TableBody | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"tbody">]> \| undefined | - | ### TableCell | Prop | Description | Type | Default | | ------------ | --------------------------- | ----------------------------------------------- | ------- | | disabled | - | boolean \| undefined | - | | value | - | number \| DateValue | - | | columns | - | number \| undefined | - | | visibleRange | - | VisibleRange \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"td">]> \| undefined | - | ### TableCellTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Dialog A modal dialog for displaying content and actions. ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Trigger Hello World This is an example of a basic dialog. Close ); } ``` ```svelte Trigger Hello World This is an example of a basic dialog. Close ``` ## Alert Dialog The [alertdialog](https://w3c.github.io/aria/#alertdialog) role enables assistive technologies and browsers to distinguish alert dialogs from other dialogs so they have the option of giving alert dialogs special treatment, such as playing a system alert sound. ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; export default function AlertDialog() { return ( Trigger Alert Something important has happened! Close ); } ``` ```svelte Trigger Alert Something important has happened! Close ``` ## Interaction If desired, you can disable click to close interactions for the backdrop. We recommend using this sparingly, as this traps the user in this experience. ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; export default function Interaction() { return ( Trigger Dialog Title This dialog will only close with the Close button or via programmatic controls. Close ); } ``` ```svelte Trigger Dialog Title This dialog will only close with the Close button or via programmatic controls. Close ``` ## Drawer This example repurposes the Dialog for use as a side-panel Drawer. It also introduces basic transition animations. ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; import { XIcon } from 'lucide-react'; export default function Drawer() { return ( Trigger
Drawer Title

This is example content for the slide out drawer panel.

); } ``` ```svelte Trigger
Drawer Title

This is example content for the slide out drawer panel.

``` ## Z-Index By default we do not take an opinionated stance regarding z-index stacking. The result is the component can sometimes be occluded beneath other elements with a higher index. The Z-Index can controlled by applying a utility class to the `Positioner` component part. ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; export default function ZIndex() { return ( Trigger Setting Z-Index This dialog will have a z-index value of 50. Close ); } ``` ```svelte Trigger Setting Z-Index This dialog will have a z-index value of 50. Close ``` ## Direction ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Trigger Hello World This is an example of a basic dialog. Close ); } ``` ```svelte Trigger Hello World This is an example of a basic dialog. Close ``` ## Headless Unlike most components in Skeleton, this feature is provided "headless". This means no default styles are applied out of the box. This ensures you retain full control of all styling. ```tsx import { Dialog, Portal } from '@skeletonlabs/skeleton-react'; import { SkullIcon } from 'lucide-react'; export default function Headless() { return (
Hello Skeleton
Skeleton Gif Three spooky skeletons!
); } ``` ```svelte
Hello Skeleton ×
Skeleton Gif Three spooky skeletons!
``` ## API Reference ### Root | Prop | Description | Type | Default | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | children | - | ReactNode | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | role | The dialog's role | "dialog" \| "alertdialog" \| undefined | "dialog" | | aria-label | Human readable label for the dialog, in event the dialog title is not rendered | string \| undefined | - | | ids | The ids of the elements in the dialog. Useful for composition. | Partial\<\{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }> \| undefined | - | | trapFocus | Whether to trap focus inside the dialog when it's opened | boolean \| undefined | true | | preventScroll | Whether to prevent scrolling behind the dialog when it's opened | boolean \| undefined | true | | modal | Whether to prevent pointer interaction outside the element and hide all content below it | boolean \| undefined | true | | initialFocusEl | Element to receive focus when the dialog is opened | (() => MaybeElement) \| undefined | - | | finalFocusEl | Element to receive focus when the dialog is closed | (() => MaybeElement) \| undefined | - | | restoreFocus | Whether to restore focus to the element that had focus before the dialog was opened | boolean \| undefined | - | | closeOnInteractOutside | Whether to close the dialog when the outside is clicked | boolean \| undefined | true | | closeOnEscape | Whether to close the dialog when the escape key is pressed | boolean \| undefined | true | | open | The controlled open state of the dialog | boolean \| undefined | - | | defaultOpen | The initial open state of the dialog when rendered. Use when you don't need to control the open state of the dialog. | boolean \| undefined | false | | onOpenChange | Function to call when the dialog's open state changes | ((details: OpenChangeDetails) => void) \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => Node \| ShadowRoot \| Document) \| undefined | - | | onEscapeKeyDown | Function called when the escape key is pressed | ((event: KeyboardEvent) => void) \| undefined | - | | onRequestDismiss | Function called when this layer is closed due to a parent layer being closed | ((event: LayerDismissEvent) => void) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | persistentElements | Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event | (() => Element \| null)\[] \| undefined | - | ### Provider | Prop | Description | Type | Default | | -------- | ----------- | --------------------- | ------- | | value | - | DialogApi\ | - | | children | - | ReactNode | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | (dialog: DialogApi\) => ReactNode | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Backdrop | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Title | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Description | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### CloseTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | role | The dialog's role | "dialog" \| "alertdialog" \| undefined | "dialog" | | aria-label | Human readable label for the dialog, in event the dialog title is not rendered | string \| undefined | - | | ids | The ids of the elements in the dialog. Useful for composition. | Partial\<\{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }> \| undefined | - | | trapFocus | Whether to trap focus inside the dialog when it's opened | boolean \| undefined | true | | preventScroll | Whether to prevent scrolling behind the dialog when it's opened | boolean \| undefined | true | | modal | Whether to prevent pointer interaction outside the element and hide all content below it | boolean \| undefined | true | | initialFocusEl | Element to receive focus when the dialog is opened | (() => MaybeElement) \| undefined | - | | finalFocusEl | Element to receive focus when the dialog is closed | (() => MaybeElement) \| undefined | - | | restoreFocus | Whether to restore focus to the element that had focus before the dialog was opened | boolean \| undefined | - | | closeOnInteractOutside | Whether to close the dialog when the outside is clicked | boolean \| undefined | true | | closeOnEscape | Whether to close the dialog when the escape key is pressed | boolean \| undefined | true | | open | The controlled open state of the dialog | boolean \| undefined | - | | defaultOpen | The initial open state of the dialog when rendered. Use when you don't need to control the open state of the dialog. | boolean \| undefined | false | | onOpenChange | Function to call when the dialog's open state changes | ((details: OpenChangeDetails) => void) \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => Node \| ShadowRoot \| Document) \| undefined | - | | onEscapeKeyDown | Function called when the escape key is pressed | ((event: KeyboardEvent) => void) \| undefined | - | | onRequestDismiss | Function called when this layer is closed due to a parent layer being closed | ((event: LayerDismissEvent) => void) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | persistentElements | Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event | (() => Element \| null)\[] \| undefined | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | -------- | ------------------------------------------------------------- | --------------------------- | ------- | | value | - | () => DialogApi\ | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------- | ------- | | children | - | Snippet\<\[() => DialogApi\]> | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Backdrop | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Title | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Description | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### CloseTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | # File Upload File upload dropzone and input patterns for selecting files. ```tsx import { FileUpload } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label Browse Files {(fileUpload) => fileUpload.acceptedFiles.map((file) => ( {file.name} {file.size} bytes )) } ); } ``` ```svelte Label Browse Files {#snippet children(fileUpload)} {#each fileUpload().acceptedFiles as file (file.name)} {file.name} {file.size} bytes {/each} {/snippet} ``` ## Custom Content Supply your own text and icons within the dropzone. ```tsx import { FileUpload } from '@skeletonlabs/skeleton-react'; import { FileIcon } from 'lucide-react'; export default function Default() { return ( Select file or drag here. Browse Files {(fileUpload) => fileUpload.acceptedFiles.map((file) => ( {file.name} {file.size} bytes )) } ); } ``` ```svelte Select file or drag here. Browse Files {#snippet children(fileUpload)} {#each fileUpload().acceptedFiles as file (file.name)} {file.name} {file.size} bytes {/each} {/snippet} ``` ## Disabled ```tsx import { FileUpload } from '@skeletonlabs/skeleton-react'; export default function Disabled() { return ( Browse Files {(fileUpload) => fileUpload.acceptedFiles.map((file) => ( {file.name} {file.size} bytes )) } ); } ``` ```svelte Browse Files {#snippet children(fileUpload)} {#each fileUpload().acceptedFiles as file (file.name)} {file.name} {file.size} bytes {/each} {/snippet} ``` ## Button Only ```tsx import { FileUpload } from '@skeletonlabs/skeleton-react'; export default function Button() { return ( Browse Files ); } ``` ```svelte Browse Files ``` ## Clear Files ```tsx import { FileUpload, useFileUpload } from '@skeletonlabs/skeleton-react'; export default function ClearFiles() { const fileUpload = useFileUpload({ defaultAcceptedFiles: [new File(['file'], 'example.png', { type: 'image/png' })], }); return (
Browse Files {(fileUpload) => fileUpload.acceptedFiles.map((file) => ( {file.name} {file.size} bytes )) }
); } ``` ```svelte
Browse Files {#snippet children(fileUpload)} {#each fileUpload().acceptedFiles as file (file.name)} {file.name} {file.size} bytes {/each} {/snippet}
``` ## Direction ```tsx import { FileUpload } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Label Browse Files {(fileUpload) => fileUpload.acceptedFiles.map((file) => ( {file.name} {file.size} bytes )) } ); } ``` ```svelte Label Browse Files {#snippet children(fileUpload)} {#each fileUpload().acceptedFiles as file (file.name)} {file.name} {file.size} bytes {/each} {/snippet} ``` ## API Reference ### Root | Prop | Description | Type | Default | | -------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | name | The name of the underlying file input | string \| undefined | - | | ids | The ids of the elements. Useful for composition. | Partial\<\{ root: string; dropzone: string; hiddenInput: string; trigger: string; label: string; item: (id: string) => string; itemName: (id: string) => string; itemSizeText: (id: string) => string; itemPreview: (id: string) => string; }> \| undefined | - | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | accept | The accept file types | Record\ \| FileMimeType \| FileMimeType\[] \| undefined | - | | disabled | Whether the file input is disabled | boolean \| undefined | - | | required | Whether the file input is required | boolean \| undefined | - | | allowDrop | Whether to allow drag and drop in the dropzone element | boolean \| undefined | true | | maxFileSize | The maximum file size in bytes | number \| undefined | Infinity | | minFileSize | The minimum file size in bytes | number \| undefined | 0 | | maxFiles | The maximum number of files | number \| undefined | 1 | | preventDocumentDrop | Whether to prevent the drop event on the document | boolean \| undefined | true | | validate | Function to validate a file | ((file: File, details: FileValidateDetails) => FileError\[] \| null) \| undefined | - | | defaultAcceptedFiles | The default accepted files when rendered. Use when you don't need to control the accepted files of the input. | File\[] \| undefined | - | | acceptedFiles | The controlled accepted files | File\[] \| undefined | - | | onFileChange | Function called when the value changes, whether accepted or rejected | ((details: FileChangeDetails) => void) \| undefined | - | | onFileAccept | Function called when the file is accepted | ((details: FileAcceptDetails) => void) \| undefined | - | | onFileReject | Function called when the file is rejected | ((details: FileRejectDetails) => void) \| undefined | - | | capture | The default camera to use when capturing media | "user" \| "environment" \| undefined | - | | directory | Whether to accept directories, only works in webkit browsers | boolean \| undefined | - | | invalid | Whether the file input is invalid | boolean \| undefined | - | | transformFiles | Function to transform the accepted files to apply transformations | ((files: File\[]) => Promise\) \| undefined | - | | locale | The current locale. Based on the BCP 47 definition. | string \| undefined | "en-US" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | FileUploadApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------------- | ------- | | children | - | (fileUpload: FileUploadApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Dropzone | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### ItemGroup | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"ul">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | file | - | File | - | | type | - | ItemType \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"li">) => Element) \| undefined | - | ### ItemName | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemSizeText | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemDeleteTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | -------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | name | The name of the underlying file input | string \| undefined | - | | ids | The ids of the elements. Useful for composition. | Partial\<\{ root: string; dropzone: string; hiddenInput: string; trigger: string; label: string; item: (id: string) => string; itemName: (id: string) => string; itemSizeText: (id: string) => string; itemPreview: (id: string) => string; }> \| undefined | - | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | accept | The accept file types | Record\ \| FileMimeType \| FileMimeType\[] \| undefined | - | | disabled | Whether the file input is disabled | boolean \| undefined | - | | required | Whether the file input is required | boolean \| undefined | - | | allowDrop | Whether to allow drag and drop in the dropzone element | boolean \| undefined | true | | maxFileSize | The maximum file size in bytes | number \| undefined | Infinity | | minFileSize | The minimum file size in bytes | number \| undefined | 0 | | maxFiles | The maximum number of files | number \| undefined | 1 | | preventDocumentDrop | Whether to prevent the drop event on the document | boolean \| undefined | true | | validate | Function to validate a file | ((file: File, details: FileValidateDetails) => FileError\[] \| null) \| undefined | - | | defaultAcceptedFiles | The default accepted files when rendered. Use when you don't need to control the accepted files of the input. | File\[] \| undefined | - | | acceptedFiles | The controlled accepted files | File\[] \| undefined | - | | onFileChange | Function called when the value changes, whether accepted or rejected | ((details: FileChangeDetails) => void) \| undefined | - | | onFileAccept | Function called when the file is accepted | ((details: FileAcceptDetails) => void) \| undefined | - | | onFileReject | Function called when the file is rejected | ((details: FileRejectDetails) => void) \| undefined | - | | capture | The default camera to use when capturing media | "user" \| "environment" \| undefined | - | | directory | Whether to accept directories, only works in webkit browsers | boolean \| undefined | - | | invalid | Whether the file input is invalid | boolean \| undefined | - | | transformFiles | Function to transform the accepted files to apply transformations | ((files: File\[]) => Promise\) \| undefined | - | | locale | The current locale. Based on the BCP 47 definition. | string \| undefined | "en-US" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => FileUploadApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | Snippet\<\[() => FileUploadApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Dropzone | Prop | Description | Type | Default | | ------------ | -------------------------------------------------- | ------------------------------------------------ | ------- | | disableClick | Whether to disable the click event on the dropzone | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### ItemGroup | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"ul">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | file | - | File | - | | type | - | ItemType \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"li">]> \| undefined | - | ### ItemName | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemSizeText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemDeleteTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | # Listbox Accessible listbox for single and multi selection. ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Default() { const collection = useListCollection({ items: data, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); return ( Label {collection.items.map((item) => ( {item.label} ))} ); } ``` ```svelte Label {#each collection.items as item (item.value)} {item.label} {/each} ``` ## Groups ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; const data = [ { label: 'Apple', value: 'apple', type: 'Fruits' }, { label: 'Banana', value: 'banana', type: 'Fruits' }, { label: 'Orange', value: 'orange', type: 'Fruits' }, { label: 'Carrot', value: 'carrot', type: 'Vegetables' }, { label: 'Broccoli', value: 'broccoli', type: 'Vegetables' }, { label: 'Spinach', value: 'spinach', type: 'Vegetables' }, ]; export default function Group() { const collection = useListCollection({ items: data, itemToString: (item) => item.label, itemToValue: (item) => item.value, groupBy: (item) => item.type, }); return ( Label {collection.group().map(([type, items]) => ( {type} {items.map((item) => ( {item.label} ))} ))} ); } ``` ```svelte Label {#each collection.group() as [type, items] (type)} {type} {#each items as item (item.value)} {item.label} {/each} {/each} ``` ## Multiple ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Multiple() { const collection = useListCollection({ items: data, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); return ( Label {collection.items.map((item) => ( {item.label} ))} ); } ``` ```svelte Label {#each collection.items as item (item.value)} {item.label} {/each} ``` ## Disabled ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Disabled() { const collection = useListCollection({ items: data, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); return ( Label {collection.items.map((item) => ( {item.label} ))} ); } ``` ```svelte Label {#each collection.items as item (item.value)} {item.label} {/each} ``` ## Disabled Item ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function DisabledItem() { const collection = useListCollection({ items: data, itemToString: (item) => item.label, itemToValue: (item) => item.value, isItemDisabled: (item) => item.value === 'banana', }); return ( Label {collection.items.map((item) => ( {item.label} ))} ); } ``` ```svelte Label {#each collection.items as item (item.value)} {item.label} {/each} ``` ## Search ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; import { useMemo, useState } from 'react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Search() { const [query, setQuery] = useState(''); const collection = useMemo(() => { const items = data.filter((item) => item.label.toLowerCase().includes(query.toLowerCase())); return useListCollection({ items }); }, [query]); return ( Label setQuery(e.currentTarget.value)} /> {collection.items.map((item) => ( {item.label} ))} ); } ``` ```svelte Label (query = e.currentTarget.value)} /> {#each collection.items as item (item.value)} {item.label} {/each} ``` ## Direction ```tsx import { Listbox, useListCollection } from '@skeletonlabs/skeleton-react'; const data = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Orange', value: 'orange' }, { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' }, ]; export default function Dir() { const collection = useListCollection({ items: data, itemToString: (item) => item.label, itemToValue: (item) => item.value, }); return ( Label {collection.items.map((item) => ( {item.label} ))} ); } ``` ```svelte Label {#each collection.items as item (item.value)} {item.label} {/each} ``` ## API Reference ### Root | Prop | Description | Type | Default | | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | orientation | The orientation of the listbox. | "horizontal" \| "vertical" \| undefined | "vertical" | | collection | The item collection | ListCollection\ \| GridCollection\ | - | | ids | The ids of the elements in the listbox. Useful for composition. | Partial\<\{ root: string; content: string; label: string; item: (id: string \| number) => string; itemGroup: (id: string \| number) => string; itemGroupLabel: (id: string \| number) => string; }> \| undefined | - | | disabled | Whether the listbox is disabled | boolean \| undefined | - | | disallowSelectAll | Whether to disallow selecting all items when \`meta+a\` is pressed | boolean \| undefined | - | | onHighlightChange | The callback fired when the highlighted item changes. | ((details: HighlightChangeDetails\) => void) \| undefined | - | | onValueChange | The callback fired when the selected item changes. | ((details: ValueChangeDetails\) => void) \| undefined | - | | value | The controlled keys of the selected items | string\[] \| undefined | - | | defaultValue | The initial default value of the listbox when rendered. Use when you don't need to control the value of the listbox. | string\[] \| undefined | \[] | | highlightedValue | The controlled key of the highlighted item | string \| null \| undefined | - | | defaultHighlightedValue | The initial value of the highlighted item when opened. Use when you don't need to control the highlighted value of the listbox. | string \| null \| undefined | - | | loopFocus | Whether to loop the keyboard navigation through the options | boolean \| undefined | false | | selectionMode | How multiple selection should behave in the listbox. - \`single\`: The user can select a single item. - \`multiple\`: The user can select multiple items without using modifier keys. - \`extended\`: The user can select multiple items by using modifier keys. | SelectionMode \| undefined | "single" | | scrollToIndexFn | Function to scroll to a specific index | ((details: ScrollToIndexDetails) => void) \| undefined | - | | selectOnHighlight | Whether to select the item when it is highlighted | boolean \| undefined | - | | deselectable | Whether to disallow empty selection | boolean \| undefined | - | | typeahead | Whether to enable typeahead on the listbox | boolean \| undefined | - | | onSelect | Function called when an item is selected | ((details: SelectionDetails) => void) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | ListboxApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | --------------------------------------------------- | ------- | | children | - | (listbox: ListboxApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Input | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"ul">) => Element) \| undefined | - | ### ItemGroup | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemGroupLabel | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | ---------------- | -------------------------------------- | ------------------------------------------------------------- | ------- | | item | The item to render | any | - | | highlightOnHover | Whether to highlight the item on hover | boolean \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"li">) => Element) \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### ItemIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | orientation | The orientation of the listbox. | "horizontal" \| "vertical" \| undefined | "vertical" | | collection | The item collection | ListCollection\ \| GridCollection\ | - | | ids | The ids of the elements in the listbox. Useful for composition. | Partial\<\{ root: string; content: string; label: string; item: (id: string \| number) => string; itemGroup: (id: string \| number) => string; itemGroupLabel: (id: string \| number) => string; }> \| undefined | - | | disabled | Whether the listbox is disabled | boolean \| undefined | - | | disallowSelectAll | Whether to disallow selecting all items when \`meta+a\` is pressed | boolean \| undefined | - | | onHighlightChange | The callback fired when the highlighted item changes. | ((details: HighlightChangeDetails\) => void) \| undefined | - | | onValueChange | The callback fired when the selected item changes. | ((details: ValueChangeDetails\) => void) \| undefined | - | | value | The controlled keys of the selected items | string\[] \| undefined | - | | defaultValue | The initial default value of the listbox when rendered. Use when you don't need to control the value of the listbox. | string\[] \| undefined | \[] | | highlightedValue | The controlled key of the highlighted item | string \| null \| undefined | - | | defaultHighlightedValue | The initial value of the highlighted item when opened. Use when you don't need to control the highlighted value of the listbox. | string \| null \| undefined | - | | loopFocus | Whether to loop the keyboard navigation through the options | boolean \| undefined | false | | selectionMode | How multiple selection should behave in the listbox. - \`single\`: The user can select a single item. - \`multiple\`: The user can select multiple items without using modifier keys. - \`extended\`: The user can select multiple items by using modifier keys. | SelectionMode \| undefined | "single" | | scrollToIndexFn | Function to scroll to a specific index | ((details: ScrollToIndexDetails) => void) \| undefined | - | | selectOnHighlight | Whether to select the item when it is highlighted | boolean \| undefined | - | | deselectable | Whether to disallow empty selection | boolean \| undefined | - | | typeahead | Whether to enable typeahead on the listbox | boolean \| undefined | - | | onSelect | Function called when an item is selected | ((details: SelectionDetails) => void) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => ListboxApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------- | ------- | | children | - | Snippet\<\[() => ListboxApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Input | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"ul">]> \| undefined | - | ### ItemGroup | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemGroupLabel | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | ---------------- | -------------------------------------- | ----------------------------------------------- | ------- | | item | The item to render | any | - | | highlightOnHover | Whether to highlight the item on hover | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"li">]> \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### ItemIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | # Navigation Navigation patterns for apps (bar, rail, sidebar, toggle). ## Bar * Recommended for small sized screens (ex: mobile). * Ideal for vertical screen layouts. * Should be fixed to the bottom of the viewport. * Supports 3-5 tiles based on contents and viewport width. * Consider progressive enhancement with the [Virtual Keyboard API](https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard_API). ```tsx import { Navigation } from '@skeletonlabs/skeleton-react'; import { BookIcon } from 'lucide-react'; import { HouseIcon } from 'lucide-react'; import { PopcornIcon } from 'lucide-react'; import { TvIcon } from 'lucide-react'; export default function Default() { const links = [ { label: 'Home', href: '#', icon: HouseIcon }, { label: 'Books', href: '#', icon: BookIcon }, { label: 'Movies', href: '#', icon: PopcornIcon }, { label: 'Television', href: '#', icon: TvIcon }, ]; let anchorBar = 'btn hover:preset-tonal flex-col items-center gap-1'; return (

Contents

{links.map((link) => { const Icon = link.icon; return ( {link.label} ); })}
); } ``` ```svelte

Contents

{#each links as link (link)} {@const Icon = link.icon} {link.label} {/each}
``` ## Rail * Recommended for medium sized screens (ex: tablet). * Ideal for horizontal screen layouts. * Should be fixed to the left or right of the viewport. * Supports 3-7 tiles based on contents and viewport height. ```tsx import { Navigation } from '@skeletonlabs/skeleton-react'; import { BookIcon } from 'lucide-react'; import { HouseIcon } from 'lucide-react'; import { PopcornIcon } from 'lucide-react'; import { SkullIcon } from 'lucide-react'; import { SettingsIcon } from 'lucide-react'; import { TvIcon } from 'lucide-react'; export default function Default() { const links = [ { label: 'Home', href: '#', icon: HouseIcon }, { label: 'Books', href: '#', icon: BookIcon }, { label: 'Movies', href: '#', icon: PopcornIcon }, { label: 'Television', href: '#', icon: TvIcon }, ]; let anchorRail = 'btn hover:preset-tonal aspect-square w-full max-w-[84px] flex flex-col items-center gap-0.5'; return (
{links.map((link) => { const Icon = link.icon; return ( {link.label} ); })}

Contents

); } ``` ```svelte
{#each links as link (link)} {@const Icon = link.icon} {link.label} {/each}

Contents

``` ## Sidebar * Recommended for large sized screens (ex: desktop). * Ideal for horizontal screen layouts. * Should be fixed to the left or right of the viewport. * Supports multiple groups of links for deep navigation. * Supports a label field per each group. * Can scroll vertically if contents extend beyond the viewport height. ```tsx import { Navigation } from '@skeletonlabs/skeleton-react'; import { BikeIcon } from 'lucide-react'; import { BookIcon } from 'lucide-react'; import { HouseIcon } from 'lucide-react'; import { MountainIcon } from 'lucide-react'; import { PopcornIcon } from 'lucide-react'; import { SailboatIcon } from 'lucide-react'; import { SettingsIcon } from 'lucide-react'; import { SkullIcon } from 'lucide-react'; import { TvIcon } from 'lucide-react'; import { WavesIcon } from 'lucide-react'; export default function Default() { const linksSidebar = { entertainment: [ { label: 'Books', href: '#', icon: BookIcon }, { label: 'Movies', href: '#', icon: PopcornIcon }, { label: 'Television', href: '#', icon: TvIcon }, ], recreation: [ { label: 'Biking', href: '#', icon: BikeIcon }, { label: 'Sailing', href: '#', icon: SailboatIcon }, { label: 'Hiking', href: '#', icon: MountainIcon }, { label: 'Swimming', href: '#', icon: WavesIcon }, ], }; let anchorSidebar = 'btn hover:preset-tonal justify-start px-2 w-full'; return (
Home {Object.entries(linksSidebar).map(([category, links]) => ( {category} {links.map((link) => { const Icon = link.icon; return ( {link.label} ); })} ))} Settings

Contents

); } ``` ```svelte
Home {#each Object.entries(linksSidebar) as [category, links]} {category} {#each links as link (link)} {@const Icon = link.icon} {link.label} {/each} {/each} Settings

Contents

``` ## Toggle Layout Using reactive state we can dynamically switch between multiple layouts. Tap the double arrow icon to toggle. ```tsx import { Navigation } from '@skeletonlabs/skeleton-react'; import { BookIcon } from 'lucide-react'; import { HouseIcon } from 'lucide-react'; import { PopcornIcon } from 'lucide-react'; import { TvIcon } from 'lucide-react'; import { ArrowLeftRightIcon } from 'lucide-react'; import { useState } from 'react'; export default function Default() { const links = [ { label: 'Home', href: '#', icon: HouseIcon }, { label: 'Books', href: '#', icon: BookIcon }, { label: 'Movies', href: '#', icon: PopcornIcon }, { label: 'Television', href: '#', icon: TvIcon }, ]; const buttonClasses = 'btn hover:preset-tonal'; let anchorRail = `${buttonClasses} aspect-square w-full max-w-[84px] flex flex-col items-center gap-0.5`; let anchorSidebar = `${buttonClasses} justify-start px-2 w-full`; let [layoutRail, setLayoutRail] = useState(true); function toggleLayout() { setLayoutRail(!layoutRail); } return (
{links.map((link) => { const Icon = link.icon; return ( {link.label} ); })}

Contents

); } ``` ```svelte
{#each links as link (link)} {@const Icon = link.icon} {link.label} {/each}
Layout: {layoutRail ? 'Rail' : 'Sidebar'}
``` ## API Reference ### Root | Prop | Description | Type | Default | | ------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------- | | layout | Sets the data-layout attribute, which modifies the visual presentation of the component set. | "bar" \| "rail" \| "sidebar" \| undefined | bar | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Header | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"header">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Group | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Menu | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Footer | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"footer">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------ | ------- | | layout | Sets the data-layout attribute, which modifies the visual presentation of the component set. | "bar" \| "rail" \| "sidebar" \| undefined | bar | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Header | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"header">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Group | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Menu | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Footer | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"footer">]> \| undefined | - | # Pagination Client and server-side pagination controls. ```tsx import { faker } from '@faker-js/faker'; import { Pagination } from '@skeletonlabs/skeleton-react'; import { ArrowRightIcon, ArrowLeftIcon } from 'lucide-react'; import { useState } from 'react'; const users = Array.from({ length: 500 }, (_, i) => ({ id: i + 1, name: faker.person.fullName(), email: faker.internet.email(), country: faker.location.country(), })); const PAGE_SIZE = 5; export default function Default() { const [page, setPage] = useState(1); const start = (page - 1) * PAGE_SIZE; const end = start + PAGE_SIZE; const data = users.slice(start, end); return (
{data.map((user) => ( ))}
ID Name Email Country
{user.id} {user.name} {user.email} {user.country}
setPage(event.page)}> {(pagination) => pagination.pages.map((page, index) => page.type === 'page' ? ( {page.value} ) : ( ), ) }
); } ``` ```svelte
{#each data as user} {/each}
ID Name Email Country
{user.id} {user.name} {user.email} {user.country}
(page = event.page)}> {#snippet children(pagination)} {#each pagination().pages as page, index (page)} {#if page.type === 'page'} {page.value} {:else} {/if} {/each} {/snippet}
``` ## Page Size ```tsx import { faker } from '@faker-js/faker'; import { Pagination } from '@skeletonlabs/skeleton-react'; import { ArrowRightIcon, ArrowLeftIcon } from 'lucide-react'; import { useState } from 'react'; const users = Array.from({ length: 500 }, (_, i) => ({ id: i + 1, name: faker.person.fullName(), email: faker.internet.email(), country: faker.location.country(), })); export default function Default() { const [page, setPage] = useState(1); const [pageSize, setPageSize] = useState(5); const start = (page - 1) * pageSize; const end = start + pageSize; const data = users.slice(start, end); return (
{data.map((user) => ( ))}
ID Name Email Country
{user.id} {user.name} {user.email} {user.country}
setPage(event.page)}> {(pagination) => pagination.pages.map((page, index) => page.type === 'page' ? ( {page.value} ) : ( ), ) }
); } ``` ```svelte
{#each data as user} {/each}
ID Name Email Country
{user.id} {user.name} {user.email} {user.country}
(page = event.page)}> {#snippet children(pagination)} {#each pagination().pages as page, index (page)} {#if page.type === 'page'} {page.value} {:else} {/if} {/each} {/snippet}
``` ## Direction ```tsx import { faker } from '@faker-js/faker'; import { Pagination } from '@skeletonlabs/skeleton-react'; import { ArrowRightIcon, ArrowLeftIcon } from 'lucide-react'; import { useState } from 'react'; const users = Array.from({ length: 500 }, (_, i) => ({ id: i + 1, name: faker.person.fullName(), email: faker.internet.email(), country: faker.location.country(), })); const PAGE_SIZE = 5; export default function Dir() { const [page, setPage] = useState(1); const start = (page - 1) * PAGE_SIZE; const end = start + PAGE_SIZE; const data = users.slice(start, end); return (
{data.map((user) => ( ))}
ID Name Email Country
{user.id} {user.name} {user.email} {user.country}
setPage(event.page)} dir="rtl"> {(pagination) => pagination.pages.map((page, index) => page.type === 'page' ? ( {page.value} ) : ( ), ) }
); } ``` ```svelte
{#each data as user} {/each}
ID Name Email Country
{user.id} {user.name} {user.email} {user.country}
(page = event.page)} dir="rtl"> {#snippet children(pagination)} {#each pagination().pages as page, index (page)} {#if page.type === 'page'} {page.value} {:else} {/if} {/each} {/snippet}
``` ## Total Count For server-side pagination, your data source may be truncated. Make sure to specify the total records using `count`. ```ts const res = { "results": [...], "pagination": { "page": 1, "limit": 10, "count": 500, } } ``` ```astro ... ``` ## API Reference ### Root | Prop | Description | Type | Default | | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ids | The ids of the elements in the accordion. Useful for composition. | Partial\<\{ root: string; ellipsis: (index: number) => string; prevTrigger: string; nextTrigger: string; item: (page: number) => string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | count | Total number of data items | number \| undefined | - | | pageSize | The controlled number of data items per page | number \| undefined | - | | defaultPageSize | The initial number of data items per page when rendered. Use when you don't need to control the page size of the pagination. | number \| undefined | 10 | | siblingCount | Number of pages to show beside active page | number \| undefined | 1 | | page | The controlled active page | number \| undefined | - | | defaultPage | The initial active page when rendered. Use when you don't need to control the active page of the pagination. | number \| undefined | 1 | | onPageChange | Called when the page number is changed | ((details: PageChangeDetails) => void) \| undefined | - | | onPageSizeChange | Called when the page size is changed | ((details: PageSizeChangeDetails) => void) \| undefined | - | | type | The type of the trigger element | "button" \| "link" \| undefined | "button" | | getPageUrl | Function to generate href attributes for pagination links. Only used when \`type\` is set to "link". | ((details: PageUrlDetails) => string) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"nav">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | PaginationApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"nav">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------------- | ------- | | children | - | (pagination: PaginationApi\) => ReactNode | - | ### FirstTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### PrevTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------ | ------- | | type | - | "page" | - | | value | - | number | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"a">) => Element) \| undefined | - | ### Ellipsis | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | index | - | number | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### NextTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### LastTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ids | The ids of the elements in the accordion. Useful for composition. | Partial\<\{ root: string; ellipsis: (index: number) => string; prevTrigger: string; nextTrigger: string; item: (page: number) => string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | count | Total number of data items | number \| undefined | - | | pageSize | The controlled number of data items per page | number \| undefined | - | | defaultPageSize | The initial number of data items per page when rendered. Use when you don't need to control the page size of the pagination. | number \| undefined | 10 | | siblingCount | Number of pages to show beside active page | number \| undefined | 1 | | page | The controlled active page | number \| undefined | - | | defaultPage | The initial active page when rendered. Use when you don't need to control the active page of the pagination. | number \| undefined | 1 | | onPageChange | Called when the page number is changed | ((details: PageChangeDetails) => void) \| undefined | - | | onPageSizeChange | Called when the page size is changed | ((details: PageSizeChangeDetails) => void) \| undefined | - | | type | The type of the trigger element | "button" \| "link" \| undefined | "button" | | getPageUrl | Function to generate href attributes for pagination links. Only used when \`type\` is set to "link". | ((details: PageUrlDetails) => string) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => PaginationApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | Snippet\<\[() => PaginationApi\]> | - | ### FirstTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### PrevTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------- | ------- | | type | - | "page" | - | | value | - | number | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"a">]> \| undefined | - | ### Ellipsis | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | index | - | number | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### NextTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### LastTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | # Popover Small overlay panels positioned relative to a trigger. ```tsx import { Popover, Portal } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Trigger Title Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. Close ); } ``` ```svelte Trigger Example This is a basic example of a popover. Close ``` ## Arrow Visually connects the popover content to the trigger element. Will automatically align based on the selected side. ```tsx import { Popover, Portal } from '@skeletonlabs/skeleton-react'; export default function Arrow() { return ( Trigger Title Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. Close ); } ``` ```svelte Trigger This example will have a small arrow. ``` ## Z-Index This component is headless by default. If you find the popover content is being clipped, try increasing the z-index on the Positioner part. In some rare cases you may need to use `!important` to override library defaults. ```tsx import { Popover, Portal } from '@skeletonlabs/skeleton-react'; export default function ZIndex() { return (
Default (auto) This example will be below the sibling. Above (20) This example will be above the sibling.
Sibling (10)
); } ``` ```svelte
Default (auto) This example will be below the sibling. Above (20) This example will be above the sibling.
Sibling (10)
``` ## Provider Pattern You can programmatically open and close the popover using the [Provider Pattern](/docs/\[framework]/get-started/fundamentals#provider-pattern). This is useful for custom interactions and keyboard handling strategies. ```tsx import { Popover, Portal, usePopover } from '@skeletonlabs/skeleton-react'; export default function Default() { const popover = usePopover({ closeOnInteractOutside: false, }); function showAndHide() { popover.setOpen(true); setTimeout(() => { popover.setOpen(false); }, 3000); } return (
Anchor This popover will appear, stay open for three seconds, then close on it's own.
); } ``` ```svelte
Anchor This popover will appear, stay open for three seconds, then close on it's own.
``` ## Direction ```tsx import { Popover, Portal } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Trigger Title Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. Close ); } ``` ```svelte Trigger Example This is a basic example of a popover. Close ``` ## Headless ```tsx import { Popover, Portal } from '@skeletonlabs/skeleton-react'; export default function Headless() { return ( Trigger Title Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. Close ); } ``` ```svelte
Hello Skeleton ×
Skeleton Gif Three spooky skeletons!
``` ## API Reference ### Root | Prop | Description | Type | Default | | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | children | - | ReactNode | - | | autoFocus | Whether to automatically set focus on the first focusable content within the popover when opened. | boolean \| undefined | true | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | ids | The ids of the elements in the popover. Useful for composition. | Partial\<\{ anchor: string; trigger: string; content: string; title: string; description: string; closeTrigger: string; positioner: string; arrow: string; }> \| undefined | - | | modal | Whether the popover should be modal. When set to \`true\`: - interaction with outside elements will be disabled - only popover content will be visible to screen readers - scrolling is blocked - focus is trapped within the popover | boolean \| undefined | false | | portalled | Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position of the popover content. | boolean \| undefined | true | | initialFocusEl | The element to focus on when the popover is opened. | (() => HTMLElement \| null) \| undefined | - | | closeOnInteractOutside | Whether to close the popover when the user clicks outside of the popover. | boolean \| undefined | true | | closeOnEscape | Whether to close the popover when the escape key is pressed. | boolean \| undefined | true | | onOpenChange | Function invoked when the popover opens or closes | ((details: OpenChangeDetails) => void) \| undefined | - | | positioning | The user provided options used to position the popover content | PositioningOptions \| undefined | - | | open | The controlled open state of the popover | boolean \| undefined | - | | defaultOpen | The initial open state of the popover when rendered. Use when you don't need to control the open state of the popover. | boolean \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => Node \| ShadowRoot \| Document) \| undefined | - | | onEscapeKeyDown | Function called when the escape key is pressed | ((event: KeyboardEvent) => void) \| undefined | - | | onRequestDismiss | Function called when this layer is closed due to a parent layer being closed | ((event: LayerDismissEvent) => void) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | persistentElements | Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event | (() => Element \| null)\[] \| undefined | - | ### Provider | Prop | Description | Type | Default | | -------- | ----------- | ---------------------- | ------- | | value | - | PopoverApi\ | - | | children | - | ReactNode | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------- | ------- | | children | - | (popover: PopoverApi\) => ReactNode | - | ### Trigger | Prop | Description | Type | Default | | -------- | --------------------------- | ----------------------------------------------------------------- | ------- | | children | - | ReactNode | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Arrow | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ArrowTip | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Title | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Description | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### CloseTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | ids | The ids of the elements in the popover. Useful for composition. | Partial\<\{ anchor: string; trigger: string; content: string; title: string; description: string; closeTrigger: string; positioner: string; arrow: string; }> \| undefined | - | | modal | Whether the popover should be modal. When set to \`true\`: - interaction with outside elements will be disabled - only popover content will be visible to screen readers - scrolling is blocked - focus is trapped within the popover | boolean \| undefined | false | | portalled | Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position of the popover content. | boolean \| undefined | true | | autoFocus | Whether to automatically set focus on the first focusable content within the popover when opened. | boolean \| undefined | true | | initialFocusEl | The element to focus on when the popover is opened. | (() => HTMLElement \| null) \| undefined | - | | closeOnInteractOutside | Whether to close the popover when the user clicks outside of the popover. | boolean \| undefined | true | | closeOnEscape | Whether to close the popover when the escape key is pressed. | boolean \| undefined | true | | onOpenChange | Function invoked when the popover opens or closes | ((details: OpenChangeDetails) => void) \| undefined | - | | positioning | The user provided options used to position the popover content | PositioningOptions \| undefined | - | | open | The controlled open state of the popover | boolean \| undefined | - | | defaultOpen | The initial open state of the popover when rendered. Use when you don't need to control the open state of the popover. | boolean \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => Node \| ShadowRoot \| Document) \| undefined | - | | onEscapeKeyDown | Function called when the escape key is pressed | ((event: KeyboardEvent) => void) \| undefined | - | | onRequestDismiss | Function called when this layer is closed due to a parent layer being closed | ((event: LayerDismissEvent) => void) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | persistentElements | Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event | (() => Element \| null)\[] \| undefined | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | -------- | ------------------------------------------------------------- | ---------------------------- | ------- | | value | - | () => PopoverApi\ | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------- | ------- | | children | - | Snippet\<\[() => PopoverApi\]> | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Arrow | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ArrowTip | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Title | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Description | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### CloseTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | # Portal Renders children into a DOM node that exists outside the DOM hierarchy. ```tsx import { Portal } from '@skeletonlabs/skeleton-react'; import { SkullIcon } from 'lucide-react'; import { useState, useRef } from 'react'; export default function Default() { const [disabled, setDisabled] = useState(true); const ref = useRef(null); const cardClasses = 'card preset-outlined-surface-300-700 size-24 grid place-items-center p-4'; const buttonClasses = 'col-span-2 btn preset-filled'; return (
{/* Source */}
{/* Target */}
{/* (the content will appear here) */}
{/* Trigger */}
); } ``` ```svelte
``` ## How It Works When enabled, the content will move from the source to the target element. ## API Reference ### Root | Prop | Description | Type | Default | | -------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | disabled | If true, the portal functionality is disabled and children are rendered in place. | boolean \| undefined | false | | target | The HTML element to which the portal content will be appended. | HTMLElement \| undefined | document.body | | children | - | string \| number \| bigint \| boolean \| ReactElement\> \| Iterable\ \| ReactPortal \| Promise\<...> \| null | - | ### Root | Prop | Description | Type | Default | | -------- | --------------------------------------------------------------------------------- | ------------------------ | ------------- | | disabled | If true, the portal functionality is disabled and children are rendered in place. | boolean \| undefined | false | | target | The HTML element to which the portal content will be appended. | HTMLElement \| undefined | document.body | | children | The default slot content to be rendered within the component. | Snippet\<\[]> | - | # Progress - Circular Circular progress indicators for showing task progress. ```tsx import { Progress, Slider } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Default() { const [value, setValue] = useState(50); return (
Label setValue(e.value[0])} step={10}>
); } ``` ```svelte
Label (value = e.value[0])} step={10}>
``` ## Size Use different sizes for context-appropriate indicators. ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; import type { CSSProperties } from 'react'; export default function Size() { return (
); } ``` ```svelte
``` ## Color Change the track and indicator colour using utility classes or custom CSS variables to match your design system. ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Color() { return (
); } ``` ```svelte
``` ## Centered Content Place content in the center of the circular progress if needed (for example, a numeric value). ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function CenteredContent() { return (
); } ``` ```svelte
``` ## Indeterminate Use a `null` value to enable indeterminate mode. ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( ); } ``` ```svelte ``` ## Format Use the `format` prop to customize the output of the `ValueText` component. Options include: * `percentage` (default) * `decimal` (0.0 - 1.0) * Custom - via the [Intl API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Format() { return (
); } ``` ```svelte
``` ## Custom Value Text Provide a custom renderer for the `ValueText` if you need to show a different layout or label. ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function CustomValueText() { return ( {(progress) => `${progress.value} of ${progress.max}`} ); } ``` ```svelte {#snippet children(progress)} {progress().value} of {progress().max} {/snippet} ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------- | | ids | The ids of the elements in the progress bar. Useful for composition. | Partial\<\{ root: string; track: string; label: string; circle: string; }> \| undefined | - | | value | The controlled value of the progress bar. | number \| null \| undefined | - | | defaultValue | The initial value of the progress bar when rendered. Use when you don't need to control the value of the progress bar. | number \| null \| undefined | 50 | | min | The minimum allowed value of the progress bar. | number \| undefined | 0 | | max | The maximum allowed value of the progress bar. | number \| undefined | 100 | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | onValueChange | Callback fired when the value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | formatOptions | The options to use for formatting the value. | NumberFormatOptions \| undefined | \{ style: "percent" } | | locale | The locale to use for formatting the value. | string \| undefined | "en-US" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | orientation | The orientation of the element. | "horizontal" \| "vertical" \| undefined | "horizontal" | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | ProgressApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------------ | ------- | | children | - | (progress: ProgressApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ValueText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Track | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Range | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Circle | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"svg">) => Element) \| undefined | - | ### CircleTrack | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"circle">) => Element) \| undefined | - | ### CircleRange | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"circle">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------- | | ids | The ids of the elements in the progress bar. Useful for composition. | Partial\<\{ root: string; track: string; label: string; circle: string; }> \| undefined | - | | value | The controlled value of the progress bar. | number \| null \| undefined | - | | defaultValue | The initial value of the progress bar when rendered. Use when you don't need to control the value of the progress bar. | number \| null \| undefined | 50 | | min | The minimum allowed value of the progress bar. | number \| undefined | 0 | | max | The maximum allowed value of the progress bar. | number \| undefined | 100 | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | onValueChange | Callback fired when the value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | formatOptions | The options to use for formatting the value. | NumberFormatOptions \| undefined | \{ style: "percent" } | | locale | The locale to use for formatting the value. | string \| undefined | "en-US" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | orientation | The orientation of the element. | "horizontal" \| "vertical" \| undefined | "horizontal" | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => ProgressApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------ | ------- | | children | - | Snippet\<\[() => ProgressApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ValueText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### Track | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Range | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Circle | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"svg">]> \| undefined | - | ### CircleTrack | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"circle">]> \| undefined | - | ### CircleRange | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"circle">]> \| undefined | - | # Progress - Linear An indicator showing the progress or completion of a task. ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( ); } ``` ```svelte {value}% ``` ## Color ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Color() { return (
); } ``` ```svelte
``` ## Height ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Height() { return (
); } ``` ```svelte
``` ## Orientation ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Orientation() { return ( ); } ``` ```svelte ``` ## Indeterminate ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Indeterminate() { return ( ); } ``` ```svelte ``` ## Custom Animation ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function CustomAnimation() { return ( <> ); } ``` ```svelte ``` ## Direction ```tsx import { Progress } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Label ); } ``` ```svelte Label ``` ## Native Alternative ```tsx export default function Native() { return ; } ``` ```svelte ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------- | | ids | The ids of the elements in the progress bar. Useful for composition. | Partial\<\{ root: string; track: string; label: string; circle: string; }> \| undefined | - | | value | The controlled value of the progress bar. | number \| null \| undefined | - | | defaultValue | The initial value of the progress bar when rendered. Use when you don't need to control the value of the progress bar. | number \| null \| undefined | 50 | | min | The minimum allowed value of the progress bar. | number \| undefined | 0 | | max | The maximum allowed value of the progress bar. | number \| undefined | 100 | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | onValueChange | Callback fired when the value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | formatOptions | The options to use for formatting the value. | NumberFormatOptions \| undefined | \{ style: "percent" } | | locale | The locale to use for formatting the value. | string \| undefined | "en-US" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | orientation | The orientation of the element. | "horizontal" \| "vertical" \| undefined | "horizontal" | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | ProgressApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------------ | ------- | | children | - | (progress: ProgressApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ValueText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Track | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Range | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Circle | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"svg">) => Element) \| undefined | - | ### CircleTrack | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"circle">) => Element) \| undefined | - | ### CircleRange | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"circle">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------- | | ids | The ids of the elements in the progress bar. Useful for composition. | Partial\<\{ root: string; track: string; label: string; circle: string; }> \| undefined | - | | value | The controlled value of the progress bar. | number \| null \| undefined | - | | defaultValue | The initial value of the progress bar when rendered. Use when you don't need to control the value of the progress bar. | number \| null \| undefined | 50 | | min | The minimum allowed value of the progress bar. | number \| undefined | 0 | | max | The maximum allowed value of the progress bar. | number \| undefined | 100 | | translations | The localized messages to use. | IntlTranslations \| undefined | - | | onValueChange | Callback fired when the value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | formatOptions | The options to use for formatting the value. | NumberFormatOptions \| undefined | \{ style: "percent" } | | locale | The locale to use for formatting the value. | string \| undefined | "en-US" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | orientation | The orientation of the element. | "horizontal" \| "vertical" \| undefined | "horizontal" | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => ProgressApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------ | ------- | | children | - | Snippet\<\[() => ProgressApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ValueText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### Track | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Range | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Circle | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"svg">]> \| undefined | - | ### CircleTrack | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"circle">]> \| undefined | - | ### CircleRange | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"circle">]> \| undefined | - | # Rating Group Rating Group allows users to rate something ```tsx import { RatingGroup } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( {(ratingGroup) => ratingGroup.items.map((index) => )} ); } ``` ```svelte {#snippet children(ratingGroup)} {#each ratingGroup().items as index (index)} {/each} {/snippet} ``` ## Allow Half ```tsx import { RatingGroup } from '@skeletonlabs/skeleton-react'; export default function Half() { return ( {(ratingGroup) => ratingGroup.items.map((index) => )} ); } ``` ```svelte {#snippet children(ratingGroup)} {#each ratingGroup().items as index (index)} {/each} {/snippet} ``` ## Custom Icons ```tsx import { RatingGroup } from '@skeletonlabs/skeleton-react'; import { BoneIcon, SkullIcon } from 'lucide-react'; export default function CustomIcons() { return ( {(ratingGroup) => ratingGroup.items.map((index) => } full={} />) } ); } ``` ```svelte {#snippet children(ratingGroup)} {#each ratingGroup().items as index (index)} {#snippet empty()} {/snippet} {#snippet full()} {/snippet} {/each} {/snippet} ``` ## Label ```tsx import { RatingGroup } from '@skeletonlabs/skeleton-react'; export default function Label() { return ( Rate us: {(ratingGroup) => ratingGroup.items.map((index) => )} ); } ``` ```svelte Rate us: {#snippet children(ratingGroup)} {#each ratingGroup().items as index (index)} {/each} {/snippet} ``` ## Disabled ```tsx import { RatingGroup } from '@skeletonlabs/skeleton-react'; export default function Page() { return ( {(ratingGroup) => ratingGroup.items.map((index) => )} ); } ``` ```svelte {#snippet children(ratingGroup)} {#each ratingGroup().items as index (index)} {/each} {/snippet} ``` ## Direction ```tsx import { RatingGroup } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Label {(ratingGroup) => ratingGroup.items.map((index) => )} ); } ``` ```svelte Label {#snippet children(ratingGroup)} {#each ratingGroup().items as index (index)} {/each} {/snippet} ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the rating. Useful for composition. | Partial\<\{ root: string; label: string; hiddenInput: string; control: string; item: (id: string) => string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | count | The total number of ratings. | number \| undefined | 5 | | name | The name attribute of the rating element (used in forms). | string \| undefined | - | | form | The associate form of the underlying input element. | string \| undefined | - | | value | The controlled value of the rating | number \| undefined | - | | defaultValue | The initial value of the rating when rendered. Use when you don't need to control the value of the rating. | number \| undefined | - | | readOnly | Whether the rating is readonly. | boolean \| undefined | - | | disabled | Whether the rating is disabled. | boolean \| undefined | - | | required | Whether the rating is required. | boolean \| undefined | - | | allowHalf | Whether to allow half stars. | boolean \| undefined | - | | autoFocus | Whether to autofocus the rating. | boolean \| undefined | - | | onValueChange | Function to be called when the rating value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | onHoverChange | Function to be called when the rating value is hovered. | ((details: HoverChangeDetails) => void) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | RatingGroupApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------------------ | ------- | | children | - | (ratingGroup: RatingGroupApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | ---------------------------------------------------------- | --------------------------------------------------------------- | --------------- | | empty | The content to render when the item is in the empty state. | ReactNode | StarEmpty (SVG) | | half | The content to render when the item is in the half state. | ReactNode | StarHalf (SVG) | | full | The content to render when the item is in the full state. | ReactNode | StarFull (SVG) | | index | - | number | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the rating. Useful for composition. | Partial\<\{ root: string; label: string; hiddenInput: string; control: string; item: (id: string) => string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | count | The total number of ratings. | number \| undefined | 5 | | name | The name attribute of the rating element (used in forms). | string \| undefined | - | | form | The associate form of the underlying input element. | string \| undefined | - | | value | The controlled value of the rating | number \| undefined | - | | defaultValue | The initial value of the rating when rendered. Use when you don't need to control the value of the rating. | number \| undefined | - | | readOnly | Whether the rating is readonly. | boolean \| undefined | - | | disabled | Whether the rating is disabled. | boolean \| undefined | - | | required | Whether the rating is required. | boolean \| undefined | - | | allowHalf | Whether to allow half stars. | boolean \| undefined | - | | autoFocus | Whether to autofocus the rating. | boolean \| undefined | - | | onValueChange | Function to be called when the rating value changes. | ((details: ValueChangeDetails) => void) \| undefined | - | | onHoverChange | Function to be called when the rating value is hovered. | ((details: HoverChangeDetails) => void) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => RatingGroupApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | --------------------------------------------- | ------- | | children | - | Snippet\<\[() => RatingGroupApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | ---------------------------------------------------------- | ------------------------------------------------- | --------------- | | empty | The content to render when the item is in the empty state. | Snippet\<\[]> \| undefined | StarEmpty (SVG) | | half | The content to render when the item is in the half state. | Snippet\<\[]> \| undefined | StarHalf (SVG) | | full | The content to render when the item is in the full state. | Snippet\<\[]> \| undefined | StarFull (SVG) | | index | - | number | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | # Segmented Control Capture input for a limited set of options. ```tsx import { SegmentedControl } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label Item 1 Item 2 Item 3 ); } ``` ```svelte Label Item 1 Item 2 Item 3 ``` ## Controlled ```tsx import { SegmentedControl } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Controlled() { const [value, setValue] = useState('item-1'); return (
setValue(details.value)}> {['item-1', 'item-2', 'item-3'].map((item) => ( {item} ))}
{value}
); } ``` ```svelte
(value = details.value)}> {#each ['item-1', 'item-2', 'item-3'] as item (item)} {item} {/each}
{value}
``` ## Icons ```tsx import { SegmentedControl } from '@skeletonlabs/skeleton-react'; import { AlignStartVerticalIcon, AlignCenterVerticalIcon, AlignEndVerticalIcon } from 'lucide-react'; export default function Icons() { return ( ); } ``` ```svelte ``` ## Orientation ```tsx import { SegmentedControl } from '@skeletonlabs/skeleton-react'; export default function Orientation() { return ( Item 1 Item 2 Item 3 ); } ``` ```svelte Item 1 Item 2 Item 3 ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the radio. Useful for composition. | Partial\<\{ root: string; label: string; indicator: string; item: (value: string) => string; itemLabel: (value: string) => string; itemControl: (value: string) => string; itemHiddenInput: (value: string) => string; }> \| undefined | - | | value | The controlled value of the radio group | string \| null \| undefined | - | | defaultValue | The initial value of the checked radio when rendered. Use when you don't need to control the value of the radio group. | string \| null \| undefined | - | | name | The name of the input fields in the radio (Useful for form submission). | string \| undefined | - | | form | The associate form of the underlying input. | string \| undefined | - | | disabled | If \`true\`, the radio group will be disabled | boolean \| undefined | - | | readOnly | Whether the checkbox is read-only | boolean \| undefined | - | | onValueChange | Function called once a radio is checked | ((details: ValueChangeDetails) => void) \| undefined | - | | orientation | Orientation of the radio group | "horizontal" \| "vertical" \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | RadioGroupApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------------------- | ------- | | children | - | (ratingGroup: RadioGroupApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Indicator | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------- | ---------------------------------------------------------------- | ------- | | value | - | string | - | | disabled | - | boolean \| undefined | - | | invalid | - | boolean \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### ItemHiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the radio. Useful for composition. | Partial\<\{ root: string; label: string; indicator: string; item: (value: string) => string; itemLabel: (value: string) => string; itemControl: (value: string) => string; itemHiddenInput: (value: string) => string; }> \| undefined | - | | value | The controlled value of the radio group | string \| null \| undefined | - | | defaultValue | The initial value of the checked radio when rendered. Use when you don't need to control the value of the radio group. | string \| null \| undefined | - | | name | The name of the input fields in the radio (Useful for form submission). | string \| undefined | - | | form | The associate form of the underlying input. | string \| undefined | - | | disabled | If \`true\`, the radio group will be disabled | boolean \| undefined | - | | readOnly | Whether the checkbox is read-only | boolean \| undefined | - | | onValueChange | Function called once a radio is checked | ((details: ValueChangeDetails) => void) \| undefined | - | | orientation | Orientation of the radio group | "horizontal" \| "vertical" \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => RadioGroupApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | Snippet\<\[() => RadioGroupApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Indicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------- | -------------------------------------------------- | ------- | | value | - | string | - | | disabled | - | boolean \| undefined | - | | invalid | - | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### ItemHiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | # Slider Capture input from a range of values. ```tsx import { Slider } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label ); } ``` ```svelte Label ``` ## Color ```tsx import { Slider } from '@skeletonlabs/skeleton-react'; export default function Color() { return (
); } ``` ```svelte
``` ## Disabled ```tsx import { Slider } from '@skeletonlabs/skeleton-react'; export default function Disabled() { return ( ); } ``` ```svelte ``` ## Read-Only ```tsx import { Slider } from '@skeletonlabs/skeleton-react'; export default function Readonly() { return ( ); } ``` ```svelte ``` ## Multiple Thumbs ```tsx import { Slider } from '@skeletonlabs/skeleton-react'; export default function MultipleThumbs() { return ( ); } ``` ```svelte ``` ## Direction ```tsx import { Slider } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Label ); } ``` ```svelte Label ``` ## API Reference ### Root | Prop | Description | Type | Default | | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | ids | The ids of the elements in the slider. Useful for composition. | Partial\<\{ root: string; thumb: (index: number) => string; hiddenInput: (index: number) => string; control: string; track: string; range: string; label: string; valueText: string; marker: (index: number) => string; }> \| undefined | - | | aria-label | The aria-label of each slider thumb. Useful for providing an accessible name to the slider | string\[] \| undefined | - | | aria-labelledby | The \`id\` of the elements that labels each slider thumb. Useful for providing an accessible name to the slider | string\[] \| undefined | - | | name | The name associated with each slider thumb (when used in a form) | string \| undefined | - | | form | The associate form of the underlying input element. | string \| undefined | - | | value | The controlled value of the slider | number\[] \| undefined | - | | defaultValue | The initial value of the slider when rendered. Use when you don't need to control the value of the slider. | number\[] \| undefined | - | | disabled | Whether the slider is disabled | boolean \| undefined | - | | readOnly | Whether the slider is read-only | boolean \| undefined | - | | invalid | Whether the slider is invalid | boolean \| undefined | - | | onValueChange | Function invoked when the value of the slider changes | ((details: ValueChangeDetails) => void) \| undefined | - | | onValueChangeEnd | Function invoked when the slider value change is done | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | Function invoked when the slider's focused index changes | ((details: FocusChangeDetails) => void) \| undefined | - | | getAriaValueText | Function that returns a human readable value for the slider thumb | ((details: ValueTextDetails) => string) \| undefined | - | | min | The minimum value of the slider | number \| undefined | 0 | | max | The maximum value of the slider | number \| undefined | 100 | | step | The step value of the slider | number \| undefined | 1 | | minStepsBetweenThumbs | The minimum permitted steps between multiple thumbs. \`minStepsBetweenThumbs\` \* \`step\` should reflect the gap between the thumbs. - \`step: 1\` and \`minStepsBetweenThumbs: 10\` => gap is \`10\` - \`step: 10\` and \`minStepsBetweenThumbs: 2\` => gap is \`20\` | number \| undefined | 0 | | orientation | The orientation of the slider | "vertical" \| "horizontal" \| undefined | "horizontal" | | origin | The origin of the slider range. The track is filled from the origin to the thumb for single values. - "start": Useful when the value represents an absolute value - "center": Useful when the value represents an offset (relative) - "end": Useful when the value represents an offset from the end | "start" \| "center" \| "end" \| undefined | "start" | | thumbAlignment | The alignment of the slider thumb relative to the track - \`center\`: the thumb will extend beyond the bounds of the slider track. - \`contain\`: the thumb will be contained within the bounds of the track. | "center" \| "contain" \| undefined | "contain" | | thumbSize | The slider thumbs dimensions | \{ width: number; height: number; } \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | SliderApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | (slider: SliderApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### ValueText | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"output">) => Element) \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Track | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Range | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Thumb | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | index | - | number | - | | name | - | string \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### MarkerGroup | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Marker | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | number | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | ids | The ids of the elements in the slider. Useful for composition. | Partial\<\{ root: string; thumb: (index: number) => string; hiddenInput: (index: number) => string; control: string; track: string; range: string; label: string; valueText: string; marker: (index: number) => string; }> \| undefined | - | | aria-label | The aria-label of each slider thumb. Useful for providing an accessible name to the slider | string\[] \| undefined | - | | aria-labelledby | The \`id\` of the elements that labels each slider thumb. Useful for providing an accessible name to the slider | string\[] \| undefined | - | | name | The name associated with each slider thumb (when used in a form) | string \| undefined | - | | form | The associate form of the underlying input element. | string \| undefined | - | | value | The controlled value of the slider | number\[] \| undefined | - | | defaultValue | The initial value of the slider when rendered. Use when you don't need to control the value of the slider. | number\[] \| undefined | - | | disabled | Whether the slider is disabled | boolean \| undefined | - | | readOnly | Whether the slider is read-only | boolean \| undefined | - | | invalid | Whether the slider is invalid | boolean \| undefined | - | | onValueChange | Function invoked when the value of the slider changes | ((details: ValueChangeDetails) => void) \| undefined | - | | onValueChangeEnd | Function invoked when the slider value change is done | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | Function invoked when the slider's focused index changes | ((details: FocusChangeDetails) => void) \| undefined | - | | getAriaValueText | Function that returns a human readable value for the slider thumb | ((details: ValueTextDetails) => string) \| undefined | - | | min | The minimum value of the slider | number \| undefined | 0 | | max | The maximum value of the slider | number \| undefined | 100 | | step | The step value of the slider | number \| undefined | 1 | | minStepsBetweenThumbs | The minimum permitted steps between multiple thumbs. \`minStepsBetweenThumbs\` \* \`step\` should reflect the gap between the thumbs. - \`step: 1\` and \`minStepsBetweenThumbs: 10\` => gap is \`10\` - \`step: 10\` and \`minStepsBetweenThumbs: 2\` => gap is \`20\` | number \| undefined | 0 | | orientation | The orientation of the slider | "vertical" \| "horizontal" \| undefined | "horizontal" | | origin | The origin of the slider range. The track is filled from the origin to the thumb for single values. - "start": Useful when the value represents an absolute value - "center": Useful when the value represents an offset (relative) - "end": Useful when the value represents an offset from the end | "start" \| "center" \| "end" \| undefined | "start" | | thumbAlignment | The alignment of the slider thumb relative to the track - \`center\`: the thumb will extend beyond the bounds of the slider track. - \`contain\`: the thumb will be contained within the bounds of the track. | "center" \| "contain" \| undefined | "contain" | | thumbSize | The slider thumbs dimensions | \{ width: number; height: number; } \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => SliderApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------- | ------- | | children | - | Snippet\<\[() => SliderApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### ValueText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"output">]> \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Track | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Range | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Thumb | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | index | - | number | - | | name | - | string \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### MarkerGroup | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Marker | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | number | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Switch Toggle between two states, such as on/off. ```tsx import { Switch } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label ); } ``` ```svelte Label ``` ## Checked Color Use the [Tailwind data attribute syntax](https://tailwindcss.com/docs/hover-focus-and-other-states#data-attributes) to target the active state using `data-[state=checked]` ```tsx import { Switch } from '@skeletonlabs/skeleton-react'; export default function Colors() { return ( Label ); } ``` ```svelte ``` ## List ```tsx import { Switch } from '@skeletonlabs/skeleton-react'; export default function List() { return (
{['Option 1', 'Option 2', 'Option 3'].map((label, i) => (
{label} {i < 2 &&
}
))}
); } ``` ```svelte
{#each ['Label 1', 'Label 2', 'Label 3'] as label, i (label)} {label} {#if i < 2}
{/if} {/each}
``` ## Icons ```tsx import { Switch } from '@skeletonlabs/skeleton-react'; import { MoonIcon, SunIcon } from 'lucide-react'; export default function ThumbIcons() { return ( {(switch_) => (switch_.checked ? : )} Label ); } ``` ```svelte {#snippet children(switch_)} {#if switch_().checked} {:else} {/if} {/snippet} ``` ## Direction ```tsx import { Switch } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Label ); } ``` ```svelte Label ``` ## API Reference ### Root | Prop | Description | Type | Default | | --------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the switch. Useful for composition. | Partial\<\{ root: string; hiddenInput: string; control: string; label: string; thumb: string; }> \| undefined | - | | label | Specifies the localized strings that identifies the accessibility elements and their states | string \| undefined | - | | disabled | Whether the switch is disabled. | boolean \| undefined | - | | invalid | If \`true\`, the switch is marked as invalid. | boolean \| undefined | - | | required | If \`true\`, the switch input is marked as required, | boolean \| undefined | - | | readOnly | Whether the switch is read-only | boolean \| undefined | - | | onCheckedChange | Function to call when the switch is clicked. | ((details: CheckedChangeDetails) => void) \| undefined | - | | checked | The controlled checked state of the switch | boolean \| undefined | - | | defaultChecked | The initial checked state of the switch when rendered. Use when you don't need to control the checked state of the switch. | boolean \| undefined | - | | name | The name of the input field in a switch (Useful for form submission). | string \| undefined | - | | form | The id of the form that the switch belongs to | string \| undefined | - | | value | The value of switch input. Useful for form submission. | string \| number \| undefined | "on" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | value | - | SwitchApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------- | ------- | | children | - | (switch\_: SwitchApi\) => ReactNode | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Thumb | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | --------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ------- | | ids | The ids of the elements in the switch. Useful for composition. | Partial\<\{ root: string; hiddenInput: string; control: string; label: string; thumb: string; }> \| undefined | - | | label | Specifies the localized strings that identifies the accessibility elements and their states | string \| undefined | - | | disabled | Whether the switch is disabled. | boolean \| undefined | - | | invalid | If \`true\`, the switch is marked as invalid. | boolean \| undefined | - | | required | If \`true\`, the switch input is marked as required, | boolean \| undefined | - | | readOnly | Whether the switch is read-only | boolean \| undefined | - | | onCheckedChange | Function to call when the switch is clicked. | ((details: CheckedChangeDetails) => void) \| undefined | - | | checked | The controlled checked state of the switch | boolean \| undefined | - | | defaultChecked | The initial checked state of the switch when rendered. Use when you don't need to control the checked state of the switch. | boolean \| undefined | - | | name | The name of the input field in a switch (Useful for form submission). | string \| undefined | - | | form | The id of the form that the switch belongs to | string \| undefined | - | | value | The value of switch input. Useful for form submission. | string \| number \| undefined | "on" | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | value | - | () => SwitchApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------- | ------- | | children | - | Snippet\<\[() => SwitchApi\]> | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### Thumb | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | # Tabs Use tabs to quickly switch between different views and pages. ```tsx import { Tabs } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ); } ``` ```svelte Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ``` ## Controlled Use the `value` and `onValueChange` props to control the active tab programmatically. ```tsx import { Tabs } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Controlled() { const [value, setValue] = useState('overview'); return ( setValue(details.value)}> Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ); } ``` ```svelte (value = details.value)}> Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ``` ## Navigation Use the `element` slot to override the default `button` with an `a` tag for navigation tabs. ```tsx import { Tabs } from '@skeletonlabs/skeleton-react'; export default function Navigation() { return ( ) => ( Overview )} /> ) => ( Key features )} /> ) => ( Activity )} /> A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ); } ``` ```svelte {#snippet element(attributes: Record)} Overview {/snippet} {#snippet element(attributes: Record)} Key features {/snippet} {#snippet element(attributes: Record)} Activity {/snippet} A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ``` ## Fluid Width Use `flex` utility classes to make the tabs stretch to fill the width of their container. ```tsx import { Tabs } from '@skeletonlabs/skeleton-react'; export default function Fluid() { return ( Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ); } ``` ```svelte Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ``` ## Vertical Use the `vertical` prop to render tabs stacked vertically. ```tsx import { Tabs } from '@skeletonlabs/skeleton-react'; export default function Vertical() { return ( Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ); } ``` ```svelte Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ``` ## Direction Use the `dir` prop to switch direction for RTL/LTR layouts. ```tsx import { Tabs } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ); } ``` ```svelte Overview Key features Activity A concise overview of the project: usage, goals, and recent highlights. Use this area to orient readers with key metrics and links to deeper docs. List the most important features here with short, pragmatic descriptions so readers can scan for what matters (accessibility, theming, integrations). Show recent activity or sample data: new releases, PRs merged, or notable user events. This helps examples feel realistic and actionable. ``` ## API Reference ### Root | Prop | Description | Type | Default | | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | ids | The ids of the elements in the tabs. Useful for composition. | Partial\<\{ root: string; trigger: (value: string) => string; list: string; content: (value: string) => string; indicator: string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | loopFocus | Whether the keyboard navigation will loop from last tab to first, and vice versa. | boolean \| undefined | true | | value | The controlled selected tab value | string \| null \| undefined | - | | defaultValue | The initial selected tab value when rendered. Use when you don't need to control the selected tab value. | string \| null \| undefined | - | | orientation | The orientation of the tabs. Can be \`horizontal\` or \`vertical\` - \`horizontal\`: only left and right arrow key navigation will work. - \`vertical\`: only up and down arrow key navigation will work. | "horizontal" \| "vertical" \| undefined | "horizontal" | | activationMode | The activation mode of the tabs. Can be \`manual\` or \`automatic\` - \`manual\`: Tabs are activated when clicked or press \`enter\` key. - \`automatic\`: Tabs are activated when receiving focus | "manual" \| "automatic" \| undefined | "automatic" | | onValueChange | Callback to be called when the selected/active tab changes | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | Callback to be called when the focused tab changes | ((details: FocusChangeDetails) => void) \| undefined | - | | composite | Whether the tab is composite | boolean \| undefined | - | | deselectable | Whether the active tab can be deselected when clicking on it. | boolean \| undefined | - | | navigate | Function to navigate to the selected tab when clicking on it. Useful if tab triggers are anchor elements. | ((details: NavigateDetails) => void) \| null \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | TabsApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------- | ------- | | children | - | (tabs: TabsApi\) => ReactNode | - | ### List | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Trigger | Prop | Description | Type | Default | | -------- | --------------------------- | ----------------------------------------------------------------- | ------- | | value | The value of the tab | string | - | | disabled | Whether the tab is disabled | boolean \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Indicator | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | The value of the tab | string | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | ids | The ids of the elements in the tabs. Useful for composition. | Partial\<\{ root: string; trigger: (value: string) => string; list: string; content: (value: string) => string; indicator: string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | loopFocus | Whether the keyboard navigation will loop from last tab to first, and vice versa. | boolean \| undefined | true | | value | The controlled selected tab value | string \| null \| undefined | - | | defaultValue | The initial selected tab value when rendered. Use when you don't need to control the selected tab value. | string \| null \| undefined | - | | orientation | The orientation of the tabs. Can be \`horizontal\` or \`vertical\` - \`horizontal\`: only left and right arrow key navigation will work. - \`vertical\`: only up and down arrow key navigation will work. | "horizontal" \| "vertical" \| undefined | "horizontal" | | activationMode | The activation mode of the tabs. Can be \`manual\` or \`automatic\` - \`manual\`: Tabs are activated when clicked or press \`enter\` key. - \`automatic\`: Tabs are activated when receiving focus | "manual" \| "automatic" \| undefined | "automatic" | | onValueChange | Callback to be called when the selected/active tab changes | ((details: ValueChangeDetails) => void) \| undefined | - | | onFocusChange | Callback to be called when the focused tab changes | ((details: FocusChangeDetails) => void) \| undefined | - | | composite | Whether the tab is composite | boolean \| undefined | - | | deselectable | Whether the active tab can be deselected when clicking on it. | boolean \| undefined | - | | navigate | Function to navigate to the selected tab when clicking on it. Useful if tab triggers are anchor elements. | ((details: NavigateDetails) => void) \| null \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => TabsApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------- | ------- | | children | - | Snippet\<\[() => TabsApi\]> | - | ### List | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Trigger | Prop | Description | Type | Default | | -------- | --------------------------- | --------------------------------------------------- | ------- | | value | The value of the tab | string | - | | disabled | Whether the tab is disabled | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Indicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | The value of the tab | string | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Tags Input Allows input of multiple values. ```tsx import { TagsInput } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label {(tagsInput) => tagsInput.value.map((value, index) => ( {value} )) } Clear All ); } ``` ```svelte Label {#snippet children(tagsInput)} {#each tagsInput().value as value, index (index)} {value} {/each} {/snippet} Clear All ``` ## Controlled ```tsx import { TagsInput } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label {(tagsInput) => tagsInput.value.map((value, index) => ( {value} )) } Clear All ); } ``` ```svelte Label {#snippet children(tagsInput)} {#each tagsInput().value as value, index (index)} {value} {/each} {/snippet} Clear All ``` ## Custom Icon ```tsx import { TagsInput } from '@skeletonlabs/skeleton-react'; import { CircleXIcon } from 'lucide-react'; export default function Default() { return ( {(tagsInput) => tagsInput.value.map((value, index) => ( {value} )) } ); } ``` ```svelte {#snippet children(tagsInput)} {#each tagsInput().value as value, index (index)} {value} {/each} {/snippet} ``` ## Color ```tsx import { TagsInput } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( {(tagsInput) => tagsInput.value.map((value, index) => ( {value} )) } ); } ``` ```svelte {#snippet children(tagsInput)} {#each tagsInput().value as value, index (index)} {value} {/each} {/snippet} ``` ## Provider Pattern Use the [Provider Pattern](/docs/\[framework]/get-started/fundamentals#provider-pattern) to gain access to the inner component APIs. ```tsx import { TagsInput, useTagsInput } from '@skeletonlabs/skeleton-react'; export default function Default() { const tagsInput = useTagsInput({ defaultValue: ['Vanilla', 'Chocolate', 'Strawberry'], }); return (
{(tagsInput) => tagsInput.value.map((value, index) => ( {value} )) } {/* Programmatic Controls */}
); } ``` ```svelte
{#snippet children(tagsInput)} {#each tagsInput().value as value, index (index)} {value} {/each} {/snippet}
``` ## Direction ```tsx import { TagsInput } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Label {(tagsInput) => tagsInput.value.map((value, index) => ( {value} )) } Clear All ); } ``` ```svelte Label {#snippet children(tagsInput)} {#each tagsInput().value as value, index (index)} {value} {/each} {/snippet} Clear All ``` ## API Reference ### Root | Prop | Description | Type | Default | | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ids | The ids of the elements in the tags input. Useful for composition. | Partial\<\{ root: string; input: string; hiddenInput: string; clearBtn: string; label: string; control: string; item: (opts: ItemProps) => string; itemDeleteTrigger: (opts: ItemProps) => string; itemInput: (opts: ItemProps) => string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | maxLength | The max length of the input. | number \| undefined | - | | delimiter | The character that serves has: - event key to trigger the addition of a new tag - character used to split tags when pasting into the input | string \| RegExp \| undefined | "," | | autoFocus | Whether the input should be auto-focused | boolean \| undefined | - | | disabled | Whether the tags input should be disabled | boolean \| undefined | - | | readOnly | Whether the tags input should be read-only | boolean \| undefined | - | | invalid | Whether the tags input is invalid | boolean \| undefined | - | | required | Whether the tags input is required | boolean \| undefined | - | | editable | Whether a tag can be edited after creation, by pressing \`Enter\` or double clicking. | boolean \| undefined | true | | inputValue | The controlled tag input's value | string \| undefined | - | | defaultInputValue | The initial tag input value when rendered. Use when you don't need to control the tag input value. | string \| undefined | - | | value | The controlled tag value | string\[] \| undefined | - | | defaultValue | The initial tag value when rendered. Use when you don't need to control the tag value. | string\[] \| undefined | - | | onValueChange | Callback fired when the tag values is updated | ((details: ValueChangeDetails) => void) \| undefined | - | | onInputValueChange | Callback fired when the input value is updated | ((details: InputValueChangeDetails) => void) \| undefined | - | | onHighlightChange | Callback fired when a tag is highlighted by pointer or keyboard navigation | ((details: HighlightChangeDetails) => void) \| undefined | - | | onValueInvalid | Callback fired when the max tag count is reached or the \`validateTag\` function returns \`false\` | ((details: ValidityChangeDetails) => void) \| undefined | - | | validate | Returns a boolean that determines whether a tag can be added. Useful for preventing duplicates or invalid tag values. | ((details: ValidateArgs) => boolean) \| undefined | - | | blurBehavior | The behavior of the tags input when the input is blurred - \`"add"\`: add the input value as a new tag - \`"clear"\`: clear the input value | "clear" \| "add" \| undefined | - | | addOnPaste | Whether to add a tag when you paste values into the tag input | boolean \| undefined | false | | max | The max number of tags | number \| undefined | Infinity | | allowOverflow | Whether to allow tags to exceed max. In this case, we'll attach \`data-invalid\` to the root | boolean \| undefined | - | | name | The name attribute for the input. Useful for form submissions | string \| undefined | - | | form | The associate form of the underlying input element. | string \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | TagsInputApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------------- | ------- | | children | - | (tagsInput: TagsInputApi\) => ReactNode | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"label">) => Element) \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------- | --------------------------------------------------------------- | ------- | | index | - | string \| number | - | | value | - | string | - | | disabled | - | boolean \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### ItemPreview | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### ItemDeleteTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### ItemInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Input | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### ClearTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | ---------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"input">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ids | The ids of the elements in the tags input. Useful for composition. | Partial\<\{ root: string; input: string; hiddenInput: string; clearBtn: string; label: string; control: string; item: (opts: ItemProps) => string; itemDeleteTrigger: (opts: ItemProps) => string; itemInput: (opts: ItemProps) => string; }> \| undefined | - | | translations | Specifies the localized strings that identifies the accessibility elements and their states | IntlTranslations \| undefined | - | | maxLength | The max length of the input. | number \| undefined | - | | delimiter | The character that serves has: - event key to trigger the addition of a new tag - character used to split tags when pasting into the input | string \| RegExp \| undefined | "," | | autoFocus | Whether the input should be auto-focused | boolean \| undefined | - | | disabled | Whether the tags input should be disabled | boolean \| undefined | - | | readOnly | Whether the tags input should be read-only | boolean \| undefined | - | | invalid | Whether the tags input is invalid | boolean \| undefined | - | | required | Whether the tags input is required | boolean \| undefined | - | | editable | Whether a tag can be edited after creation, by pressing \`Enter\` or double clicking. | boolean \| undefined | true | | inputValue | The controlled tag input's value | string \| undefined | - | | defaultInputValue | The initial tag input value when rendered. Use when you don't need to control the tag input value. | string \| undefined | - | | value | The controlled tag value | string\[] \| undefined | - | | defaultValue | The initial tag value when rendered. Use when you don't need to control the tag value. | string\[] \| undefined | - | | onValueChange | Callback fired when the tag values is updated | ((details: ValueChangeDetails) => void) \| undefined | - | | onInputValueChange | Callback fired when the input value is updated | ((details: InputValueChangeDetails) => void) \| undefined | - | | onHighlightChange | Callback fired when a tag is highlighted by pointer or keyboard navigation | ((details: HighlightChangeDetails) => void) \| undefined | - | | onValueInvalid | Callback fired when the max tag count is reached or the \`validateTag\` function returns \`false\` | ((details: ValidityChangeDetails) => void) \| undefined | - | | validate | Returns a boolean that determines whether a tag can be added. Useful for preventing duplicates or invalid tag values. | ((details: ValidateArgs) => boolean) \| undefined | - | | blurBehavior | The behavior of the tags input when the input is blurred - \`"add"\`: add the input value as a new tag - \`"clear"\`: clear the input value | "clear" \| "add" \| undefined | - | | addOnPaste | Whether to add a tag when you paste values into the tag input | boolean \| undefined | false | | max | The max number of tags | number \| undefined | Infinity | | allowOverflow | Whether to allow tags to exceed max. In this case, we'll attach \`data-invalid\` to the root | boolean \| undefined | - | | name | The name attribute for the input. Useful for form submissions | string \| undefined | - | | form | The associate form of the underlying input element. | string \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | onPointerDownOutside | Function called when the pointer is pressed down outside the component | ((event: PointerDownOutsideEvent) => void) \| undefined | - | | onFocusOutside | Function called when the focus is moved outside the component | ((event: FocusOutsideEvent) => void) \| undefined | - | | onInteractOutside | Function called when an interaction happens outside the component | ((event: InteractOutsideEvent) => void) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => TagsInputApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------- | ------- | | children | - | Snippet\<\[() => TagsInputApi\]> | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"label">]> \| undefined | - | ### Control | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------- | ------------------------------------------------- | ------- | | index | - | string \| number | - | | value | - | string | - | | disabled | - | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### ItemPreview | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ItemText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### ItemDeleteTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### ItemInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### Input | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | ### ClearTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### HiddenInput | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"input">]> \| undefined | - | # Toast Display brief messages to users. ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; export default function Default() { const toaster = createToaster({}); return ( <> {(toast) => ( {toast.title} {toast.description} )} ); } ``` ```svelte {#snippet children(toast)} {toast.title} {toast.description} {/snippet} ``` ## Usage This component acts as a Singleton - meaning you only implement a single instance (typically at the root scope of your app) and then reuse it over and over. To do this, implement the `` at the root scope of your app (the root layout), and use a shared `createToaster()` instance to trigger messages to that group from anywhere in your application. ## Type ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; export default function Type() { const toaster = createToaster({}); return ( <>
{(toast) => ( {toast.title} {toast.description} )} ); } ``` ```svelte
{#snippet children(toast)} {toast.title} {toast.description} {/snippet} ``` ## Placement ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; export default function Placement() { const toaster = createToaster({ placement: 'bottom-end', }); return ( <> {(toast) => ( {toast.title} {toast.description} )} ); } ``` ```svelte {#snippet children(toast)} {toast.title} {toast.description} {/snippet} ``` ## Action ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; export default function Action() { const toaster = createToaster({}); return ( <> {(toast) => ( {toast.title} {toast.description} {toast.action && {toast.action.label}} )} ); } ``` ```svelte {#snippet children(toast)} {toast.title} {toast.description} {#if toast.action} {toast.action.label} {/if} {/snippet} ``` ## Closable ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; export default function Closable() { const toaster = createToaster({}); return ( <> {(toast) => ( {toast.title} {toast.description} {toast.closable && } )} ); } ``` ```svelte {#snippet children(toast)} {toast.title} {toast.description} {#if toast.closable} {/if} {/snippet} ``` ## Meta ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; import { SkullIcon } from 'lucide-react'; export default function Meta() { const toaster = createToaster({}); return ( <> {(toast) => ( {toast.meta!.icon} {toast.title} {toast.description} )} ); } ``` ```svelte {#snippet skull()} {/snippet} {#snippet children(toast)} {@render toast.meta!.icon()} {toast.title} {toast.description} {toast.meta?.foo} {/snippet} ``` ## Promise ```tsx import { Toast, createToaster } from '@skeletonlabs/skeleton-react'; export default function Promise_() { const toaster = createToaster({}); function generatePositiveNumber() { return new Promise((resolve, reject) => { setTimeout(() => { const number = Math.random() - 0.5; if (number > 0) { resolve(number); } else { reject(number); } }, 2000); }); } return ( <> {(toast) => ( {toast.title} {toast.description} )} ); } ``` ```svelte {#snippet children(toast)} {toast.title} {toast.description} {/snippet} ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | toast | - | Omit\, "id" \| "parent"> | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------------- | ------- | | children | - | (toast: ToastApi\) => ReactNode | - | ### Group | Prop | Description | Type | Default | | -------- | --------------------------- | -------------------------------------------------------------- | ------- | | toaster | - | ToastStore\ | - | | children | - | ((toast: ToastProps\) => Element \| null) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Message | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Title | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Description | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ActionTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### CloseTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | toast | - | Options\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | -------------------------------------------- | ------- | | children | - | Snippet\<\[() => ToastApi\]> | - | ### Group | Prop | Description | Type | Default | | -------- | --------------------------- | ------------------------------------------------ | ------- | | toaster | - | ToastStore\ | - | | children | - | Snippet\<\[ToastProps\]> \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Message | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Title | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Description | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ActionTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### CloseTrigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | # Toggle Group Grouped buttons for toggling option states. ```tsx import { ToggleGroup } from '@skeletonlabs/skeleton-react'; import { BoldIcon, ItalicIcon, UnderlineIcon } from 'lucide-react'; export default function Default() { return ( ); } ``` ```svelte ``` ## Controlled ```tsx import { ToggleGroup } from '@skeletonlabs/skeleton-react'; import { BoldIcon, ItalicIcon, UnderlineIcon } from 'lucide-react'; import { useState } from 'react'; export default function Controlled() { const [value, setValue] = useState(['bold']); return (
setValue(details.value)} multiple>
{JSON.stringify(value)}
); } ``` ```svelte
(value = details.value)} multiple>
{JSON.stringify(value)}
``` ## Orientation Use the `orientation` prop to change the layout direction of the Toggle Group. ```tsx import { ToggleGroup } from '@skeletonlabs/skeleton-react'; import { BoldIcon, ItalicIcon, UnderlineIcon } from 'lucide-react'; export default function Orientation() { return (

Horizontal

Vertical

); } ``` ```svelte

Horizontal

Vertical

``` ## Direction Use the `dir` prop to change the text direction (LTR/RTL). ```tsx import { ToggleGroup } from '@skeletonlabs/skeleton-react'; import { BoldIcon, ItalicIcon, UnderlineIcon } from 'lucide-react'; export default function Dir() { return ( ); } ``` ```svelte ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------ | | ids | The ids of the elements in the toggle. Useful for composition. | Partial\<\{ root: string; item: (value: string) => string; }> \| undefined | - | | disabled | Whether the toggle is disabled. | boolean \| undefined | - | | value | The controlled selected value of the toggle group. | string\[] \| undefined | - | | defaultValue | The initial selected value of the toggle group when rendered. Use when you don't need to control the selected value of the toggle group. | string\[] \| undefined | - | | onValueChange | Function to call when the toggle is clicked. | ((details: ValueChangeDetails) => void) \| undefined | - | | loopFocus | Whether to loop focus inside the toggle group. | boolean \| undefined | true | | rovingFocus | Whether to use roving tab index to manage focus. | boolean \| undefined | true | | orientation | The orientation of the toggle group. | Orientation \| undefined | "horizontal" | | multiple | Whether to allow multiple toggles to be selected. | boolean \| undefined | - | | deselectable | Whether the toggle group allows empty selection. \*\*Note:\*\* This is ignored if \`multiple\` is \`true\`. | boolean \| undefined | true | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | ToggleGroupApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ------------------------------------------------------ | ------- | | children | - | (togglegroup: ToggleGroupApi\) => ReactNode | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------- | ----------------------------------------------------------------- | ------- | | value | - | string | - | | disabled | - | boolean \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------ | | ids | The ids of the elements in the toggle. Useful for composition. | Partial\<\{ root: string; item: (value: string) => string; }> \| undefined | - | | disabled | Whether the toggle is disabled. | boolean \| undefined | - | | value | The controlled selected value of the toggle group. | string\[] \| undefined | - | | defaultValue | The initial selected value of the toggle group when rendered. Use when you don't need to control the selected value of the toggle group. | string\[] \| undefined | - | | onValueChange | Function to call when the toggle is clicked. | ((details: ValueChangeDetails) => void) \| undefined | - | | loopFocus | Whether to loop focus inside the toggle group. | boolean \| undefined | true | | rovingFocus | Whether to use roving tab index to manage focus. | boolean \| undefined | true | | orientation | The orientation of the toggle group. | Orientation \| undefined | "horizontal" | | multiple | Whether to allow multiple toggles to be selected. | boolean \| undefined | - | | deselectable | Whether the toggle group allows empty selection. \*\*Note:\*\* This is ignored if \`multiple\` is \`true\`. | boolean \| undefined | true | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => ToggleGroupApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | --------------------------------------------- | ------- | | children | - | Snippet\<\[() => ToggleGroupApi\]> | - | ### Item | Prop | Description | Type | Default | | -------- | --------------------------- | --------------------------------------------------- | ------- | | value | - | string | - | | disabled | - | boolean \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | # Tooltip A floating label that appears on hover or focus, providing additional context. ```tsx import { Portal, Tooltip } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Hover Me Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. ); } ``` ```svelte Hover Me Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. ``` ## Arrow You may optionally enable arrows via the `Arrow` and `ArrowTip` component parts. Note that Zag.js opts to style these with CSS custom properties, which can be adjusted using a `style` attribute. ```tsx import { Portal, Tooltip } from '@skeletonlabs/skeleton-react'; export default function Arrow() { return ( Hover Me Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. ); } ``` ```svelte Hover Me Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. ``` ## Z-Index ```tsx import { Portal, Tooltip } from '@skeletonlabs/skeleton-react'; export default function ZIndex() { return (
Default (auto) This example will be below the sibling. Above (20) This example will be above the sibling.
Sibling (10)
); } ``` ```svelte
Default (auto) This example will be below the sibling. Above (20) This example will be above the sibling.
Sibling (10)
``` ## Headless ```tsx import { Portal, Tooltip } from '@skeletonlabs/skeleton-react'; export default function Headless() { return ( Hover Me Skeleton Gif

Three spooky skeletons!

); } ``` ```svelte Hover Me Skeleton Gif

Three spooky skeletons!

``` ## Provider Pattern Use the [Provider Pattern](/docs/\[framework]/get-started/fundamentals#provider-pattern) to programmatically open and close the tooltip. ```tsx import { Portal, Tooltip, useTooltip } from '@skeletonlabs/skeleton-react'; export default function Programmatic() { const tooltip = useTooltip(); return (
Anchor ({tooltip.open ? 'open' : 'closed'}) Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim.
); } ``` ```svelte
Anchor ({tooltip().open ? 'open' : 'closed'}) Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim.
``` ## Direction ```tsx import { Portal, Tooltip } from '@skeletonlabs/skeleton-react'; export default function Dir() { return ( Hover Me Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. ); } ``` ```svelte Hover Me Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente magni distinctio explicabo quisquam. Rerum impedit culpa nesciunt enim. ``` ## API Reference ### Root | Prop | Description | Type | Default | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------- | | children | - | ReactNode | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | aria-label | Custom label for the tooltip. | string \| undefined | - | | ids | The ids of the elements in the tooltip. Useful for composition. | Partial\<\{ trigger: string; content: string; arrow: string; positioner: string; }> \| undefined | - | | openDelay | The open delay of the tooltip. | number \| undefined | 400 | | closeDelay | The close delay of the tooltip. | number \| undefined | 150 | | closeOnPointerDown | Whether to close the tooltip on pointerdown. | boolean \| undefined | true | | closeOnEscape | Whether to close the tooltip when the Escape key is pressed. | boolean \| undefined | true | | closeOnScroll | Whether the tooltip should close on scroll | boolean \| undefined | true | | closeOnClick | Whether the tooltip should close on click | boolean \| undefined | true | | interactive | Whether the tooltip's content is interactive. In this mode, the tooltip will remain open when user hovers over the content. | boolean \| undefined | false | | onOpenChange | Function called when the tooltip is opened. | ((details: OpenChangeDetails) => void) \| undefined | - | | positioning | The user provided options used to position the popover content | PositioningOptions \| undefined | - | | disabled | Whether the tooltip is disabled | boolean \| undefined | - | | open | The controlled open state of the tooltip | boolean \| undefined | - | | defaultOpen | The initial open state of the tooltip when rendered. Use when you don't need to control the open state of the tooltip. | boolean \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => Node \| ShadowRoot \| Document) \| undefined | - | ### Provider | Prop | Description | Type | Default | | -------- | ----------- | ---------------------- | ------- | | value | - | TooltipApi\ | - | | children | - | ReactNode | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ---------------------------------------------- | ------- | | children | - | (tooltip: TooltipApi\) => ReactNode | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Arrow | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### ArrowTip | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------- | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | aria-label | Custom label for the tooltip. | string \| undefined | - | | ids | The ids of the elements in the tooltip. Useful for composition. | Partial\<\{ trigger: string; content: string; arrow: string; positioner: string; }> \| undefined | - | | openDelay | The open delay of the tooltip. | number \| undefined | 400 | | closeDelay | The close delay of the tooltip. | number \| undefined | 150 | | closeOnPointerDown | Whether to close the tooltip on pointerdown. | boolean \| undefined | true | | closeOnEscape | Whether to close the tooltip when the Escape key is pressed. | boolean \| undefined | true | | closeOnScroll | Whether the tooltip should close on scroll | boolean \| undefined | true | | closeOnClick | Whether the tooltip should close on click | boolean \| undefined | true | | interactive | Whether the tooltip's content is interactive. In this mode, the tooltip will remain open when user hovers over the content. | boolean \| undefined | false | | onOpenChange | Function called when the tooltip is opened. | ((details: OpenChangeDetails) => void) \| undefined | - | | positioning | The user provided options used to position the popover content | PositioningOptions \| undefined | - | | disabled | Whether the tooltip is disabled | boolean \| undefined | - | | open | The controlled open state of the tooltip | boolean \| undefined | - | | defaultOpen | The initial open state of the tooltip when rendered. Use when you don't need to control the open state of the tooltip. | boolean \| undefined | - | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => Node \| ShadowRoot \| Document) \| undefined | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | -------- | ------------------------------------------------------------- | ---------------------------- | ------- | | value | - | () => TooltipApi\ | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------- | ------- | | children | - | Snippet\<\[() => TooltipApi\]> | - | ### Trigger | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"button">]> \| undefined | - | ### Positioner | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Content | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Arrow | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### ArrowTip | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Tree View Used to display hierarchical data. ```tsx import { TreeView, createTreeViewCollection } from '@skeletonlabs/skeleton-react'; import { FileIcon, FolderIcon } from 'lucide-react'; interface Node { id: string; name: string; children?: Node[]; } function TreeNode(props: { node: Node; indexPath: number[] }) { return ( {props.node.children ? ( {props.node.name} {props.node.children.map((childNode, childIndex) => ( ))} ) : ( {props.node.name} )} ); } export default function Default() { const collection = createTreeViewCollection({ nodeToValue: (node) => node.id, nodeToString: (node) => node.name, rootNode: { id: 'root', name: '', children: [ { id: 'node_modules', name: 'node_modules', children: [ { id: 'node_modules/@skeletonlabs', name: '@skeletonlabs', children: [ { id: 'node_modules/@skeletonlabs/skeleton', name: 'skeleton', }, ], }, ], }, { id: 'package.json', name: 'package.json', }, ], }, }); return ( File System {collection.rootNode.children?.map((node, index) => ( ))} ); } ``` ```svelte File System {#each collection.rootNode.children || [] as node, index (node)} {@render treeNode(node, [index])} {/each} {#snippet treeNode(node: Node, indexPath: number[])} {#if node.children} {node.name} {#each node.children as childNode, childIndex (childNode)} {@render treeNode(childNode, [...indexPath, childIndex])} {/each} {:else} {node.name} {/if} {/snippet} ``` ## Controlled ```tsx import { TreeView, createTreeViewCollection } from '@skeletonlabs/skeleton-react'; import { FileIcon, FolderIcon } from 'lucide-react'; interface Node { id: string; name: string; children?: Node[]; } function TreeNode(props: { node: Node; indexPath: number[] }) { return ( {props.node.children ? ( {props.node.name} {props.node.children.map((childNode, childIndex) => ( ))} ) : ( {props.node.name} )} ); } export default function Default() { const collection = createTreeViewCollection({ nodeToValue: (node) => node.id, nodeToString: (node) => node.name, rootNode: { id: 'root', name: '', children: [ { id: 'node_modules', name: 'node_modules', children: [ { id: 'node_modules/@skeletonlabs', name: '@skeletonlabs', children: [ { id: 'node_modules/@skeletonlabs/skeleton', name: 'skeleton', }, ], }, ], }, { id: 'package.json', name: 'package.json', }, ], }, }); return ( File System {collection.rootNode.children?.map((node, index) => ( ))} ); } ``` ```svelte File System {#each collection.rootNode.children || [] as node, index (node)} {@render treeNode(node, [index])} {/each} {#snippet treeNode(node: Node, indexPath: number[])} {#if node.children} {node.name} {#each node.children as childNode, childIndex (childNode)} {@render treeNode(childNode, [...indexPath, childIndex])} {/each} {:else} {node.name} {/if} {/snippet} ``` ## Multiple Selection * Windows: Hold + left click with mouse. * MacOS: Hold + left click with mouse. ```tsx import { TreeView, createTreeViewCollection } from '@skeletonlabs/skeleton-react'; import { FileIcon, FolderIcon } from 'lucide-react'; interface Node { id: string; name: string; children?: Node[]; } function TreeNode(props: { node: Node; indexPath: number[] }) { return ( {props.node.children ? ( {props.node.name} {props.node.children.map((childNode, childIndex) => ( ))} ) : ( {props.node.name} )} ); } export default function MultipleSelection() { const collection = createTreeViewCollection({ nodeToValue: (node) => node.id, nodeToString: (node) => node.name, rootNode: { id: 'root', name: '', children: [ { id: 'node_modules', name: 'node_modules', children: [ { id: 'node_modules/@skeletonlabs', name: '@skeletonlabs', children: [ { id: 'node_modules/@skeletonlabs/skeleton', name: 'skeleton', }, ], }, ], }, { id: 'package.json', name: 'package.json', }, ], }, }); return ( File System {collection.rootNode.children?.map((node, index) => ( ))} ); } ``` ```svelte File System {#each collection.rootNode.children || [] as node, index (node)} {@render treeNode(node, [index])} {/each} {#snippet treeNode(node: Node, indexPath: number[])} {#if node.children} {node.name} {#each node.children as childNode, childIndex (childNode)} {@render treeNode(childNode, [...indexPath, childIndex])} {/each} {:else} {node.name} {/if} {/snippet} ``` ## Collapse and Expand Use the [Provider Pattern](/docs/\[framework]/get-started/fundamentals#provider-pattern) to gain access to the `collapse` and `expand` methods on the `TreeView` instance. ```tsx import { TreeView, createTreeViewCollection, useTreeView } from '@skeletonlabs/skeleton-react'; import { FileIcon, FolderIcon } from 'lucide-react'; interface Node { id: string; name: string; children?: Node[]; } function TreeNode(props: { node: Node; indexPath: number[] }) { return ( {props.node.children ? ( {props.node.name} {props.node.children.map((childNode, childIndex) => ( ))} ) : ( {props.node.name} )} ); } export default function CollapseExpand() { const collection = createTreeViewCollection({ nodeToValue: (node) => node.id, nodeToString: (node) => node.name, rootNode: { id: 'root', name: '', children: [ { id: 'node_modules', name: 'node_modules', children: [ { id: 'node_modules/@skeletonlabs', name: '@skeletonlabs', children: [ { id: 'node_modules/@skeletonlabs/skeleton', name: 'skeleton', }, ], }, ], }, { id: 'package.json', name: 'package.json', }, ], }, }); const treeView = useTreeView({ collection: collection, }); return (
File System {collection.rootNode.children?.map((node, index) => ( ))}
); } ``` ```svelte
File System {#each collection.rootNode.children || [] as node, index (node)} {@render treeNode(node, [index])} {/each}
{#snippet treeNode(node: Node, indexPath: number[])} {#if node.children} {node.name} {#each node.children as childNode, childIndex (childNode)} {@render treeNode(childNode, [...indexPath, childIndex])} {/each} {:else} {node.name} {/if} {/snippet} ``` ## Lazy Loading ```tsx import { TreeView, createTreeViewCollection, type TreeViewRootProps } from '@skeletonlabs/skeleton-react'; import { FileIcon, FolderIcon, LoaderIcon } from 'lucide-react'; import { useState } from 'react'; interface Node { id: string; name: string; children?: Node[]; childrenCount?: number; } const response: Record = { node_modules: [ { id: 'node_modules/@skeletonlabs', name: '@skeletonlabs', childrenCount: 3, }, ], 'node_modules/@skeletonlabs': [ { id: 'node_modules/@skeletonlabs/skeleton', name: 'skeleton', }, { id: 'node_modules/@skeletonlabs/skeleton-react', name: 'skeleton-react', }, { id: 'node_modules/@skeletonlabs/skeleton-svelte', name: 'skeleton-svelte', }, ], }; function TreeNode(props: { node: Node; indexPath: number[] }) { return ( {props.node.children || props.node.childrenCount ? ( {props.node.name} {props.node.children?.map((childNode, childIndex) => ( ))} ) : ( {props.node.name} )} ); } export default function LazyLoading() { const [collection, setCollection] = useState( createTreeViewCollection({ nodeToValue: (node) => node.id, nodeToString: (node) => node.name, rootNode: { id: 'root', name: '', children: [ { id: 'node_modules', name: 'node_modules', childrenCount: 1, }, { id: 'package.json', name: 'package.json', }, ], }, }), ); const loadChildren: TreeViewRootProps['loadChildren'] = async (details) => { await new Promise((resolve) => setTimeout(resolve, 1000)); return response[details.node.id] || []; }; const onLoadChildrenComplete: TreeViewRootProps['onLoadChildrenComplete'] = (details) => { setCollection(details.collection); }; return ( File System {collection.rootNode.children?.map((node, index) => ( ))} ); } ``` ```svelte File System {#each collection.rootNode.children || [] as node, index (node)} {@render treeNode(node, [index])} {/each} {#snippet treeNode(node: Node, indexPath: number[])} {#if node.children || node.childrenCount} {node.name} {#each node.children ?? [] as childNode, childIndex (childNode)} {@render treeNode(childNode, [...indexPath, childIndex])} {/each} {:else} {node.name} {/if} {/snippet} ``` ## API Reference ### Root | Prop | Description | Type | Default | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------- | | collection | The tree collection data | TreeCollection\ \| undefined | - | | ids | The ids of the tree elements. Useful for composition. | Partial\<\{ root: string; tree: string; label: string; node: (value: string) => string; }> \| undefined | - | | expandedValue | The controlled expanded node ids | string\[] \| undefined | - | | defaultExpandedValue | The initial expanded node ids when rendered. Use when you don't need to control the expanded node value. | string\[] \| undefined | - | | selectedValue | The controlled selected node value | string\[] \| undefined | - | | defaultSelectedValue | The initial selected node value when rendered. Use when you don't need to control the selected node value. | string\[] \| undefined | - | | defaultCheckedValue | The initial checked node value when rendered. Use when you don't need to control the checked node value. | string\[] \| undefined | - | | checkedValue | The controlled checked node value | string\[] \| undefined | - | | defaultFocusedValue | The initial focused node value when rendered. Use when you don't need to control the focused node value. | string \| null \| undefined | - | | focusedValue | The value of the focused node | string \| null \| undefined | - | | selectionMode | Whether the tree supports multiple selection - "single": only one node can be selected - "multiple": multiple nodes can be selected | "single" \| "multiple" \| undefined | "single" | | onExpandedChange | Called when the tree is opened or closed | ((details: ExpandedChangeDetails\) => void) \| undefined | - | | onSelectionChange | Called when the selection changes | ((details: SelectionChangeDetails\) => void) \| undefined | - | | onFocusChange | Called when the focused node changes | ((details: FocusChangeDetails\) => void) \| undefined | - | | onCheckedChange | Called when the checked value changes | ((details: CheckedChangeDetails) => void) \| undefined | - | | canRename | Function to determine if a node can be renamed | ((node: T, indexPath: IndexPath) => boolean) \| undefined | - | | onRenameStart | Called when a node starts being renamed | ((details: RenameStartDetails\) => void) \| undefined | - | | onBeforeRename | Called before a rename is completed. Return false to prevent the rename. | ((details: RenameCompleteDetails) => boolean) \| undefined | - | | onRenameComplete | Called when a node label rename is completed | ((details: RenameCompleteDetails) => void) \| undefined | - | | onLoadChildrenComplete | Called when a node finishes loading children | ((details: LoadChildrenCompleteDetails\) => void) \| undefined | - | | onLoadChildrenError | Called when loading children fails for one or more nodes | ((details: LoadChildrenErrorDetails\) => void) \| undefined | - | | expandOnClick | Whether clicking on a branch should open it or not | boolean \| undefined | true | | typeahead | Whether the tree supports typeahead search | boolean \| undefined | true | | loadChildren | Function to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding. | ((details: LoadChildrenDetails\) => Promise\) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | value | - | TreeViewApi\ | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------------------- | ------- | | children | - | (treeView: TreeViewApi\) => ReactNode | - | ### Tree | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------------------- | ------- | | level | The level of the heading. | 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| undefined | - | | element | Render the element yourself | ((attributes: HTMLAttributes\<"h3">) => Element) \| undefined | - | ### NodeProvider | Prop | Description | Type | Default | | -------- | ----------- | --------- | ------- | | value | - | NodeProps | - | | children | - | ReactNode | - | ### Branch | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### BranchControl | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### BranchText | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### BranchIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | --------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"span">) => Element) \| undefined | - | ### BranchContent | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### BranchIndentGuide | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | --------------------------- | -------------------------------------------------------------- | ------- | | element | Render the element yourself | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | - | ### Root | Prop | Description | Type | Default | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------- | | collection | The tree collection data | TreeCollection\ \| undefined | - | | ids | The ids of the tree elements. Useful for composition. | Partial\<\{ root: string; tree: string; label: string; node: (value: string) => string; }> \| undefined | - | | expandedValue | The controlled expanded node ids | string\[] \| undefined | - | | defaultExpandedValue | The initial expanded node ids when rendered. Use when you don't need to control the expanded node value. | string\[] \| undefined | - | | selectedValue | The controlled selected node value | string\[] \| undefined | - | | defaultSelectedValue | The initial selected node value when rendered. Use when you don't need to control the selected node value. | string\[] \| undefined | - | | defaultCheckedValue | The initial checked node value when rendered. Use when you don't need to control the checked node value. | string\[] \| undefined | - | | checkedValue | The controlled checked node value | string\[] \| undefined | - | | defaultFocusedValue | The initial focused node value when rendered. Use when you don't need to control the focused node value. | string \| null \| undefined | - | | focusedValue | The value of the focused node | string \| null \| undefined | - | | selectionMode | Whether the tree supports multiple selection - "single": only one node can be selected - "multiple": multiple nodes can be selected | "single" \| "multiple" \| undefined | "single" | | onExpandedChange | Called when the tree is opened or closed | ((details: ExpandedChangeDetails\) => void) \| undefined | - | | onSelectionChange | Called when the selection changes | ((details: SelectionChangeDetails\) => void) \| undefined | - | | onFocusChange | Called when the focused node changes | ((details: FocusChangeDetails\) => void) \| undefined | - | | onCheckedChange | Called when the checked value changes | ((details: CheckedChangeDetails) => void) \| undefined | - | | canRename | Function to determine if a node can be renamed | ((node: T, indexPath: IndexPath) => boolean) \| undefined | - | | onRenameStart | Called when a node starts being renamed | ((details: RenameStartDetails\) => void) \| undefined | - | | onBeforeRename | Called before a rename is completed. Return false to prevent the rename. | ((details: RenameCompleteDetails) => boolean) \| undefined | - | | onRenameComplete | Called when a node label rename is completed | ((details: RenameCompleteDetails) => void) \| undefined | - | | onLoadChildrenComplete | Called when a node finishes loading children | ((details: LoadChildrenCompleteDetails\) => void) \| undefined | - | | onLoadChildrenError | Called when loading children fails for one or more nodes | ((details: LoadChildrenErrorDetails\) => void) \| undefined | - | | expandOnClick | Whether clicking on a branch should open it or not | boolean \| undefined | true | | typeahead | Whether the tree supports typeahead search | boolean \| undefined | true | | loadChildren | Function to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding. | ((details: LoadChildrenDetails\) => Promise\) \| undefined | - | | dir | The document's text/writing direction. | "ltr" \| "rtl" \| undefined | "ltr" | | getRootNode | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | (() => ShadowRoot \| Node \| Document) \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Provider | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | value | - | () => TreeViewApi\ | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Context | Prop | Description | Type | Default | | -------- | ----------- | ----------------------------------------------- | ------- | | children | - | Snippet\<\[() => TreeViewApi\]> | - | ### Tree | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Label | Prop | Description | Type | Default | | ------- | --------------------------- | ----------------------------------------------- | ------- | | level | The level of the heading. | 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| undefined | - | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"h3">]> \| undefined | - | ### NodeProvider | Prop | Description | Type | Default | | -------- | ------------------------------------------------------------- | -------------------------- | ------- | | value | - | NodeProps | - | | children | The default slot content to be rendered within the component. | Snippet\<\[]> \| undefined | - | ### Branch | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### BranchControl | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### BranchText | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### BranchIndicator | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------- | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"span">]> \| undefined | - | ### BranchContent | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### BranchIndentGuide | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | ### Item | Prop | Description | Type | Default | | ------- | --------------------------- | ------------------------------------------------ | ------- | | element | Render the element yourself | Snippet\<\[HTMLAttributes\<"div">]> \| undefined | - | # Code Block Learn how to integrate Shiki, a beautiful yet powerful syntax highlighter. Shiki (式, a Japanese word for "Style") is a beautiful and powerful syntax highlighter based on TextMate grammar and themes, the same engine as VS Code's syntax highlighting. It provides accurate and fast syntax highlighting for almost any mainstream programming language. ## Installation [Install Shiki](https://shiki.style/guide/install) with your preferred package manager. ```bash npm install -D shiki ``` ## Next.js Integration Shiki provides [official documentation](https://shiki.style/packages/next) for integrating into Next.js. This guide will follow this outline. ## Create a Component A reusable component should suffice in most projects. Follow the steps below. 1. Implement a new `` component in `/src/lib/components/code-block.svelte`. 2. Implement several variations of our `` component in any SvelteKit route `+page.svelte`. 1) Implement a new `` component in `/src/components/code-block.tsx`. 2) Implement several variations of our `` component in any route `page.tsx`. ```svelte
``` ```svelte
{@html generatedHtml}
``` ```tsx import CodeBlock from './code-block'; export default function Page() { return (
); } ``` ```tsx import { createHighlighterCore } from 'shiki/core'; import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'; const highlighter = await createHighlighterCore({ langs: [import('@shikijs/langs/bash'), import('@shikijs/langs/css'), import('@shikijs/langs/html'), import('@shikijs/langs/javascript')], themes: [import('@shikijs/themes/github-dark')], engine: createJavaScriptRegexEngine(), }); interface CodeBlockProps { code: Parameters[0]; lang?: Parameters[1]['lang']; // Base Style Props base?: string; background?: string; rounded?: string; shadow?: string; classes?: string; // Pre Style Props preBase?: string; prePadding?: string; preClasses?: string; } export default function CodeBlock({ code = '', lang = 'txt', // Base Style Props base = 'overflow-hidden', background = 'bg-neutral-950', rounded = 'rounded-container', shadow = '', classes = '', // Pre Style Props preBase = '', prePadding = '[&>pre]:p-4', preClasses = '', }: CodeBlockProps) { const html = highlighter.codeToHtml(code, { lang, theme: 'github-dark', }); return (
); } ``` A few things of note about this component: * You will need to import and configure any number of [Shiki themes](https://shiki.style/themes). * You will need to import and configure any number of [supported languages](https://shiki.style/languages). * The component has been implemented using Skeleton's [component style guidelines](/docs/\[framework]/resources/contribute/components). * This provides a number of style props for easy customization via Skeleton's standard conventions. * The component exposes `code`, `lang`, and `theme` properties to configure on-the-fly. * The Code Block `
` tag is auto-generated by Shiki; target utility classes with: `[&>pre]:myClassHere`.

## Programmatic Usage

In some cases you may not have direct access to the source code, such as content from a blog posts or CMS pages. In fact the code may even come pre-baked with surrounding `
` or `` elements. For this, you'll need to follow the general steps below. Specific implementation may differ based on your app and framework.

1. Query all `
` or `` blocks using Javascript tools like `document.querySelectorAll()`. Be as specific as possible.
2. Ensure you have a clean instance of the source code itself, with no extra markup injected within.
3. Use Shiki's [codeToHtml](https://shiki.style/guide/install#shorthands) feature to parse the code as styled HTML markup.
4. Then append each instance of the code blocks in your DOM.

## Custom Themes

Shiki provides support for generating a custom highlighter theme:

* [Loading Custom Themes](https://shiki.style/guide/load-theme)
* [List of Bundled Themes](https://shiki.style/themes)

Shiki theme values can be defined using Skeleton custom theme properties, such as `rgba(--color-primary-500)`.

## Accessibility

See [Salma Alam-Naylor's](https://whitep4nth3r.com/about/) guidelines for [creating accessible code blocks](https://whitep4nth3r.com/blog/how-to-make-your-code-blocks-accessible-on-your-website/) that meet WGAC standards.

# Bits UI

Flexible, unstyled, and accessible primitives that provide the foundation for building your own high-quality Svelte component library.

Bits UI is a collection of headless component primitives for Svelte that prioritizes developer experience, accessibility, and flexibility. The goal is to empower developers to build high-quality, accessible user interfaces without sacrificing creative control or performance.

At minimum, we recommend you read the following documentation before you start this integration guide.

* [Getting Started](https://www.bits-ui.com/docs/getting-started)
* [Styling](https://www.bits-ui.com/docs/styling)

## Requirements

\| Tooling                              | Minimum Supported |
\| ------------------------------------ | ----------------- |
\| [Svelte](https://svelte.dev/)        | 5                 |
\| [Skeleton](https://skeleton.dev)     | 3                 |
\| [Tailwind](https://tailwindcss.com/) | 4                 |
\| [Bits UI](https://www.bits-ui.com/)  | 1                 |

## Introduction

In this guide we'll implement the following Bits UI `` component. This will showcase the bare minimum requirements for integrating Skeleton with Bits UI.

## Get Started

## Styling

Each Bits UI component accepts a `class` attribute. Use this to provide Tailwind and Skeleton utility classes.

### Basic Styles

Styling the `` parent component.

```svelte

	

```

Styling the `` sub-component. You can clone these to `` too.

```svelte

	

```

Styling the `` sub-component.

```svelte

	
	{date.day}

```

For the sake of time we won't cover every sub-component.

### Complete Example

Below is a complete example showing the entire component with all styles and basic configuration.

```svelte



	{#snippet children({ months, weekdays })}
		
			
				
			
			
			
				
			
		
		
{#each months as month, i (i)} {#each weekdays as day}
{day.slice(0, 2)}
{/each}
{#each month.weeks as weekDates} {#each weekDates as date} {date.day} {/each} {/each}
{/each}
{/snippet}
``` ## Going Further If you wish to match Skeleton component conventions, view our [contributor component guidelines](/docs/\[framework]/resources/contribute/components). ## Attribution Bits UI is created and maintained by [Huntabyte](https://github.com/huntabyte). Consider [sponsoring him](https://github.com/sponsors/huntabyte) to support this open source project. # Melt UI An open-source Svelte library for building high-quality, accessible design systems and web apps. Melt UI empowers developers to create accessible UIs that embody their unique style. With a strong focus on accessibility, limitless customization options, and an overall delightful developer experience, Melt UI strives to be the de-facto headless UI library for Svelte. At minimum, we recommend you read the following documentation before you start this integration guide. * [Styling](https://next.melt-ui.com/guides/styling) * [How to Use](https://next.melt-ui.com/guides/how-to-use) ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------ | ------------------ | \| [Svelte](https://svelte.dev/) | 5 | \| [Skeleton](https://skeleton.dev) | 3 | \| [Tailwind](https://tailwindcss.com/) | 4 | \| [Melt UI](https://next.melt-ui.com/) | (Svelte 5 version) | ## Introduction In this guide we'll implement the following Melt UI `` component. This will showcase the bare minimum requirements for integrating Skeleton with Melt UI. ## Get Started ## Styling Melt UI builders are made up of native HTML elements, meaning you can implement classes directly. Use this to provide Tailwind and Skeleton utility classes. ### Basic Styles Styling the root element. ```svelte
``` Styling the trigger button element. ```svelte ``` Styling content element, including animations based on the `data-state` value. ```svelte
``` Before the close of the `#each` block, insert the follow to insert a `
` divider. ```svelte {#if index < items.length - 1}
{/if} ``` ### Complete Example Below is a complete example showing the entire component with styles, transitions, and some basic configuration. ```svelte
{#each items as i, index} {@const item = accordion.getItem(i)}

{#if item.isExpanded}
{item.item.description}
{/if} {#if index < items.length - 1}
{/if} {/each}
``` ## Going Further If you wish to match Skeleton component conventions, view our [contributor component guidelines](/docs/\[framework]/resources/contribute/components). ## Attribution Melt UI is created and maintained by [TGlide](https://github.com/TGlide). Consider [sponsoring him](https://github.com/sponsors/TGlide) to support this open source project. # Radix UI Unstyled, accessible, open source React primitives for high-quality web apps and design systems. Radix Primitives is a low-level UI component library with a focus on accessibility, customization and developer experience. You can use these components either as the base layer of your design system, or adopt them incrementally. At minimum, we recommend you read the following documentation before you start this integration guide. * [Introduction](https://www.radix-ui.com/primitives/docs/overview/introduction) * [Getting Started](https://www.radix-ui.com/primitives/docs/overview/getting-started) * [Styling](https://www.radix-ui.com/primitives/docs/guides/styling) ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------- | ----------------- | \| [React](https://react.dev/) | 18 | \| [Skeleton](https://skeleton.dev) | 3 | \| [Radix UI](https://www.radix-ui.com/) | 1 | \| [Tailwind](https://tailwindcss.com/) | 4 | ## Introduction In this guide we'll implement the following Radix UI `` component. This will showcase the bare minimum requirements for integrating Skeleton with Radix UI. ## Get Started ## Styling Each Radix UI component accepts a `className` prop. Use this to provide Tailwind and Skeleton utility classes. ### Basic Styles Styling the `` component. ```tsx {/* ... */} ``` Styling each item component. Apply these styles to each button. ```tsx {/* ... */} ``` ### Complete Example Below is a complete example showing the entire component with all styles and basic configuration. ```tsx import * as RadixToggleGroup from '@radix-ui/react-toggle-group'; import { useState, type FC } from 'react'; interface ToggleGroupProps { /* ... */ } export const ToggleGroup: FC = () => { const [value, setValue] = useState('left'); return ( { if (value) setValue(value); }} aria-label="Text alignment" > Left Center Right ); }; ``` ## Going Further If you wish to match Skeleton component conventions, view our [contributor component guidelines](/docs/\[framework]/resources/contribute/components). ## Attribution Radix UI is created and maintained by [WorkOS](https://workos.com/). # Contribute Learn how to contribute to Skeleton. # LLMs Documentation for LLMs. Beep Boop. The Skeleton `LLMs.txt` files provide concise, up-to-date documentation optimized for large language models. The have been implemented to follow the **LLM.txt Standard**. ## Paths \| Path | Description | \| ------------------------------------ | --------------------------------------------------------- | \| [/llms.txt](/llms.txt) | Comprehensive list of LLMs txt files. | \| [/llms-react.txt](/llms-react.txt) | Complete documentation for Skeleton, tailored for React. | \| [/llms-svelte.txt](/llms-svelte.txt) | Complete documentation for Skeleton, tailored for Svelte. | \| [/llms-full.txt](/llms-full.txt) | Complete documentation for Skeleton |