This is the developer documentation for Skeleton, an adaptive design system powered by Tailwind CSS, featuring React specific examples. # Introduction Skeleton integrates with Tailwind to provide an opinionated solution for generating adaptive design systems. Including easy to use components for your favorite web frameworks. ## Our Philosophy 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. {

Framework Agnostic

Skeleton's core features are framework agnostic, only requiring the use of{' '} Tailwind CSS . This provides full access to all design system features, while enabling you to standardize the design process for your framework of choice.

Native-First

We aim to embrace the interface of the web, not replace it. This is why Skeleton defaults to semantic HTML elements and native browser APIs. Beyond ease of use, we feel this offers a huge advantages to accessibility.

Simple Standards

We aim to standardize the design process, providing common conventions that are easy to learn and retain, whether you work alone or in a team environment. Covering common fixtures such as themes, colors, typography, spacing, and more.

Utility-First

Skeleton embraces the{' '} utility-first {' '} methodology for styling, supporting all features provided by{' '} Tailwind , while extending its capabilities in meaningful ways. Providing full support for the encapsulated components of the modern web.

Opt-In by Default

Most features in Skeleton are modular and opt-in by default. Enabling interface features like buttons and typography via dedicated utility classes. This allows for a simple escape hatch when you need to draw outside the lines and generate custom interfaces.

Adaptive

Skeleton is intended to adapt to the design and aesthetic of your project, while still providing reasonable defaults. Providing a powerful{' '} theme generator {' '} for custom themes, while also supplying a curated set of themes for those less design savvy.

} ## Additional Benefits {

Functional Components

{/* prettier-ignore */}

Skeleton provides an optional suite of functional components built atop the foundation of Zag.js. These components automatically adapt to the Skeleton design system out of the box. We currently support React and Svelte, with plans for other frameworks in the future.

Open Source

{/* prettier-ignore */}

Skeleton is provided as free and open-source software (FOSS) under the MIT License.

The Community

{/* prettier-ignore */}

A huge community of users and contributors across GitHub, Discord, and Bluesky.

Frequent Updates

{/* prettier-ignore */}

Skeleton has maintained a frequent release cadence over for years. Just take a look at our Releases.

Figma UI Kit

{/* prettier-ignore */}

Skeleton provides access to a fully featured Figma UI Kit to assist designers in drafting a visual concept of upcoming projects.

} *** ## Get Started ### Using Skeleton Ready to get started? Check out our comprehensive [installation guides](/docs/get-started/installation) and begin [learning the fundamentals](/docs/get-started/fundamentals). ### Contributing Please refer to our dedicated [Contribution Guidelines](/docs/resources/contribute) if you wish to contribute directly. # Next.js Install and configure Skeleton for Next.js. {/* --- */} ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------ | ----------------- | \| [Next.js](https://nextjs.org/) | 15 | \| [React](https://react.dev/) | 18 | \| [Tailwind](https://tailwindcss.com/) | 4 | ## Installation # Installation Learn how to install and setup Skeleton for your project. {/* --- */} ## Mixing UI Libraries Skeleton's design system is perfect for complementing headless component libraries, such as [Bits UI](/docs/headless/bits-ui), [Melt UI](/docs/headless/melt-ui), [Radix](/docs/headless/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. # SvelteKit Install and configure Skeleton for SvelteKit. {/* --- */} ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------ | ----------------- | \| [SvelteKit](https://svelte.dev/) | 2 | \| [Svelte](https://svelte.dev/) | 5 | \| [Tailwind](https://tailwindcss.com/) | 4 | ## Installation # Fundamentals An introduction to the core concepts of Skeleton. {

Skeleton is comprised of three pillars - the design system, our extensions to Tailwind, and an optional suite of framework-specific components. Together these form a comprehensive solution for designing and implementing complex web interfaces at scale.

} *** ## Design System ### Figma UI Kit A fully featured [Figma UI Kit](/figma) is available to designers, allowing them to quickly draft visual concept of your project. ### Iconography Skeleton is icon agnostic, meaning you may bring your own iconography solution. However, we highly recommend [Lucide](https://lucide.dev/) and utilize it for all examples in our documentation. Refer to our integration guides for [React](/docs/integrations/iconography/react) and [Svelte](/docs/integrations/iconography/svelte). ### 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/resources/contribute/components). # Vite + React Install and configure Skeleton for Vite + React. {/* --- */} ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------ | ----------------- | \| [Vite](https://vite.dev/) | 6 | \| [React](https://react.dev/) | 18 | \| [Tailwind](https://tailwindcss.com/) | 4 | ## Installation # 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/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/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/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. # Vite + Svelte Install and configure Skeleton for Vite + Svelte. {/* --- */} ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------ | ----------------- | \| [Vite](https://vite.dev/) | 6 | \| [Svelte](https://svelte.dev/) | 5 | \| [Tailwind](https://tailwindcss.com/) | 4 | ## Installation # Astro Install and configure Skeleton for Astro. {/* --- */} ## Requirements \| Tooling | Minimum Supported | \| ------------------------------------ | ----------------- | \| [Astro](https://vite.dev/) | 5 | \| [React](https://react.dev/) | 18 | \| [Svelte](https://svelte.dev/) | 5 | \| [Tailwind](https://tailwindcss.com/) | 4 | ## Installation Learn how to install the Skeleton core into your Astro project. We'll cover using components in the section below. ## Using Components in Astro While Astro can support [multiple Frontend frameworks](https://docs.astro.build/en/guides/integrations-guide/), please be aware this comes with some notable restrictions: * With the exception of this [experimental React flag](https://docs.astro.build/en/guides/integrations-guide/react/#children-parsing), components cannot utilize slotted content in `.astro` files. * You will need to install additional packages for both Astro and Skeleton per your framework of choice. * You may need a *wrapper* component to use to utilize all component feature. We'll demo this below. # Other Frameworks Install Skeleton for other frameworks. {/* --- */} ## Requirements Skeleton's [Core Package](/docs/get-started/core-api) is framework agnostic, meaning many of the Design System and Tailwind-centric features can used on any number of frameworks. This includes everything *except* components. In order to install Skeleton for additional framework, your app must be able to support the following: \| Tooling | Minimum Supported | \| ------------------------------------ | --------------------- | \| Package Management | NPM, PNPM, Yarn, etc. | \| [Tailwind](https://tailwindcss.com/) | 4 | The exact instructions for installing Skeleton will differ per framework, however we've provided a general guidance below. Use this as a foundation for getting started in any number of unofficially supported frameworks. ## Installation ## Support While we officially limit support for Skeleton to React, Svelte, and Astro for now, Skeleton has an active community of users on [GitHub](https://github.com/skeletonlabs/skeleton/discussions) and [Discord](https://discord.gg/EXqV7W8MtY). If you need support (directly related to Skeleton) considering reaching out in these spaces. Other members of the community may be able to assist you. # Migrate from v2 Learn how to migrate from Skeleton v2 to the latest version. ## Introduction 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. ```shell 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/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. ```console 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. *** ## Additional 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/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/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/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 [style prop conventions](/docs/get-started/fundamentals#style-props) and cross-framework standardization. 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 denoted the most notable changes to each component in the table below: \| Name | v2 | v3 | Notes | \| ------------------ | ----------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | \| `` | [Link](https://v2.skeleton.dev/components/app-rail) | [Link](/docs/components/navigation/svelte) | Renamed `` - greatly expanded features | \| `` | [Link](https://v2.skeleton.dev/components/file-buttons) | [Link](/docs/components/file-upload/svelte) | Renamed `` - merges `` features | \| `` | [Link](https://v2.skeleton.dev/components/file-buttons) | [Link](/docs/components/file-upload/svelte) | Renamed `` - merges `` features | \| `` | [Link](https://v2.skeleton.dev/components/input-chips) | [Link](/docs/components/tags-input/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/paginators) | [Link](/docs/components/pagination/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/progress-bars) | [Link](/docs/components/progress/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/progress-radials) | [Link](/docs/components/progress-ring/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/radio-groups) | [Link](/docs/components/segment/svelte) | Renamed `` (aka Segmented Control) | \| `` | [Link](https://v2.skeleton.dev/components/range-sliders) | [Link](/docs/components/slider/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/slide-toggles) | [Link](/docs/components/switch/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/tabs) | [Link](/docs/components/tabs/svelte) | Renamed `` | \| `` | [Link](https://v2.skeleton.dev/components/tree-views) | -- | Coming soon - [Track progress](https://github.com/skeletonlabs/skeleton/issues/2358#issuecomment-2313215789) | ### 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/guides/mode). * You are still required to implement the [Tailwind Forms Plugin](/docs/tailwind/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 ` ``` ## How It Works This is enabled by the native [Dialog](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element, which includes a dedicated Javascript API for toggling the display. ## Animations Animating `display: none` with CSS alone has limited browser support. However, per the video below, we can use progressive enhancement our dialog to ensure animations degrade gracefully for unsupported browsers. ## Alternatives If you need finer grain control, consider Skeleton's integration guides for [Floating UI](https://floating-ui.com/). * [React Popovers](/docs/integrations/popover/react) - powered by Floating UI React. * [Svelte Popovers](/docs/integrations/popover/svelte) - powered by Floating UI Svelte. # Dynamic Theme Loading Load skeleton themes on demand. ## About Themes The most common way to load skeleton themes is by importing them in your root stylesheet. This will bundle your themes when you build your application, for that reason you should only import the themes you need because they will increase your CSS bundle size. While this is sufficient for most applications this might not be flexible enough for your needs, you may want themes to be user specific, editable, organization specific and so on, since skeleton themes are just CSS variables there are many ways you can load themes on demand, read further to see how. ## Creating Stylesheets on layout load This approach assumes the CSS variables of the skeleton theme you want is available during the load function (eg: on your database or in memory). In this example we will add a default theme that that can be used as a fallback. > ⚠️ *Important* make sure you sanitize the CSS before inserting it or you'll be vulnerable to CSS injection. After doing so you should be able to toggle themes on demand by changing the `data-theme` attribute on the `html` tag. Note that there are multiple ways to go about this problem, another way could be to generate CSS files with the same content as the one in this example and then load only the css files you want, while this is more complex than storing and retrieving themes as JSON on a database this approach could benefit from the browser caching mechanism. # Floating UI Attachments A Svelte-focused guide around integrating Floating UI and Svelte attachments. Please note that this is a Svelte-only guide based around the [attachments](https://svelte.dev/docs/svelte/svelte-attachments) feature introduced in Svelte `v5.29`. ### Summary The following will guide you through integrating [Floating UI](https://floating-ui.com/) in Svelte and generating a baseline [attachment](https://svelte.dev/docs/svelte/svelte-attachments) that can be used to scaffold any number of custom popover interfaces, including but not limited to: popovers, tooltips, dialogs, drawers, combobox, context menus, and more. ### Accessibility Warning This guide is not a drop-in replacement for Skeleton's [Svelte Popovers](/docs/components/popover/svelte) as it does not replicate all recommended accessbility features out of the box (such as ARIA attributes, focus states, keyboard interactions, etc). These features are out of scope of this guide. It will be your responsibility to handle these features before using this in a production environment. ### Target Audience This guide is intended for advanced Svelte users that wish to integrate directly with Floating UI, build custom floating interfaces, and go beyond the scope of Skeleton's [Svelte Popovers](/docs/integrations/popover/svelte). This can be used to generate interfaces not covered by Skeleton's Popover components. ## Installing Floating UI To begin, install the standard version of Floating UI. ```console npm install @floating-ui/dom ``` If this is your first time using Floating UI, we recommend following the [guided tutorial](https://floating-ui.com/docs/tutorial) to learn the basics. ## Creating a Svelte Attachment Next, let's generate our custom attachment. If you're working with SvelteKit, we recommend adding this to `/src/lib/attachments/floating.svelte.ts`. This attachment will handle the following critical functionality: 1. This imports the Svelte attachment and Floating UI dependencies. 2. Scaffolds a simple `PopoverOptions` interface, which defines our configuraton options. 3. Implement the `Popover` class, which handles all the business logic for creating and using the attachment. 4. And of course sets the default configuration via `options`. We'll cover each additional method below. ### reference() When implemented, this is spread to the **Trigger** element and handles interaction such as `click` and `hover`. ### floating() When implemented, this is spread to the **Popover** element itself. This uses [createAttachmentKey](https://svelte.dev/docs/svelte/svelte-attachments#createAttachmentKey) to generate the attachment relationship itself. ### isOpen() Returns the current `open` state as a boolean value. We'll use this to show and hide the popover on demand. ### #updatePosition() This scaffolds [computePosition](https://floating-ui.com/docs/computePosition), which handles most of Floating UI's functionality. ## Making the Tooltip Float Floating UI [requires these CSS styles](https://floating-ui.com/docs/tutorial#making-the-tooltip-float) to ensure the popover element "floats" over other UI. For this guide we'll handle this with a convention by adding the following your to global stylesheet. For SvelteKit this is located in `/src/app.css`. ```css [data-floating] { width: max-content; position: absolute; top: 0; left: 0; } ``` ## Usage ### Popover Add the following to any page within your application to generate a basic popover. 1. First, import the Popover attachment and generate an instance using `new Popover()`. 2. Next, create a wrapping `` to ensure your popover is not affected by the flow of the document. 3. Add your trigger button and spread the `popover.reference()` 4. Add your popover element and spread the `popover.floating()` 5. Apply `data-floating` to the popover element. 6. Wrap the popover element with `#if popover.isOpen()` to show/hide the popover. > TIP: you can optionally import a [Svelte transition](https://svelte.dev/docs/svelte/svelte-transition), such as `slide`. Then use this to trigger animations on the open/close state for the popover. ### Tooltip Add the following to any page within your application to generate a basic tooltip. 1. Similar to the Popover - we import, initialize, and scaffold the common attachment requirements. 2. Unlike the Popover though, we configure `new Popover({ ... })` to adjust `interaction` and `placement` settings. 3. We can also use a different transition, such as `fade`, as shown above. ## Handling Accessibility We recommend you follow the [Aria APG patterns](https://www.w3.org/WAI/ARIA/apg/patterns/) when generating popover interfaces for production use. We've linked a few of the common patterns below to help you get started. This covers `aria` and `role` attributes, keyboard interactions, and other best practices. * [Alert and Message Dialogs Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/) * [Alert Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) * [Combobox Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) * [Dialog (Modal) Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/) * [Menu and Menubar Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/) * [Tooltip](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/) # Image Layouts Layouts for displaying sets of images. ## Grid ```astro
``` ## Quad ```astro
``` ## Masonry ```astro
``` ## Featured ```astro
``` ## Attribution Images courtesy of [Lorem Picsum](https://picsum.photos/). Markup and styles inspired by [Flowbite](https://flowbite.com/docs/components/gallery/#masonry-grid). # Light Switch Learn how to create a Light Switch toggle. Use [Dark Mode](/docs/guides/mode) to make use of either a base or `dark:` variant for your utility class styles. By default, Tailwind uses the `prefers-color-scheme` media query to determine and match the user's operating system settings. However, if you wish to provide your users manual control, you'll need to adjust the Dark Mode strategy for Tailwind, as well as provide the toggle interface (aka a light switch). This guide will show you how to fulfill both requirements. {/* prettier-ignore */} ## User Interface While we utilize a primitive Switch for the minimal example above, feel free to adjust the logic and interface to your preference. We provide a more detailed Switch example for [React](/docs/components/switch/react#light-switch) and [Svelte](/docs/components/switch/svelte#light-switch) respectively. ## Next.js Users For Next.js users, you will need to [suppressHydrationWarning](https://nextjs.org/docs/messages/react-hydration-error#solution-3-using-suppresshydrationwarning) to `true` on the root `` element. This will suppress hydration warnings. # Logo Clouds Provides a grid for presenting a set of logos, brands, or sponsors. ```astro ``` ## Rows ```astro ``` # Scroll Containers Create scrolling containers using the scroll snap features from Tailwind. ## Scroll Snap Implements Tailwind's [Scroll Snap Alignment](https://tailwindcss.com/docs/scroll-snap-align) utility classes. ```astro
{ Array.from({ length: 8 }).map((_, i) => ( // Each scrollable card element
{i + 1}
)) }
``` ## Carousels Using Scroll Containers, we can create a fully functional carousel, complete with thumbnail selection. ```astro --- import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react'; const generatedArray = Array.from({ length: 6 }); ---
{ generatedArray.map((_, i: number) => ( {`full-${i}`} )) }
{ generatedArray.map((_, i: number) => ( )) }
``` ## Multi-Column Using Scroll Containers, we can scroll sets of items. ```astro --- import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react'; interface Movie { name: string; imageUrl: string; url: string; } // Data and images via: https://www.themoviedb.org/ export const movies: Movie[] = [ { name: 'The Flash', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/rktDFPbfHfUbArZ6OOOKsXcv0Bm.jpg', url: 'https://www.themoviedb.org/movie/298618-the-flash', }, { name: 'Guardians of the Galaxy Vol. 3', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/r2J02Z2OpNTctfOSN1Ydgii51I3.jpg', url: 'https://www.themoviedb.org/movie/447365-guardians-of-the-galaxy-vol-3', }, { name: 'Black Panther: Wakanda Forever', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/sv1xJUazXeYqALzczSZ3O6nkH75.jpg', url: 'https://www.themoviedb.org/movie/505642-black-panther-wakanda-forever', }, { name: 'Avengers: Infinity War', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg', url: 'https://www.themoviedb.org/movie/299536-avengers-infinity-war', }, { name: 'Spider-Man: No Way Home', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/1g0dhYtq4irTY1GPXvft6k4YLjm.jpg', url: 'https://www.themoviedb.org/movie/634649-spider-man-no-way-home', }, { name: 'The Batman', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/74xTEgt7R36Fpooo50r9T25onhq.jpg', url: 'https://www.themoviedb.org/movie/414906-the-batman', }, { name: 'Iron Man', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/78lPtwv72eTNqFW9COBYI0dWDJa.jpg', url: 'https://www.themoviedb.org/movie/1726-iron-man', }, { name: 'Venom: Let There Be Carnage', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/rjkmN1dniUHVYAtwuV3Tji7FsDO.jpg', url: 'https://www.themoviedb.org/movie/580489-venom-let-there-be-carnage', }, { name: 'Deadpool', imageUrl: 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/3E53WEZJqP6aM84D8CckXx4pIHw.jpg', url: 'https://www.themoviedb.org/movie/293660-deadpool', }, ]; ---
{ movies.map((movie) => ( {movie.name} )) }
``` > Images courtesy of [The Movie Database](https://www.themoviedb.org/) ## API Reference Learn more about Tailwind's utility classes for scroll behavior and scroll snap. \| Feature | Description | \| ------------------------------------------------------------------- | ------------------------------------------------------------------- | \| [scroll-behavior](https://tailwindcss.com/docs/scroll-behavior) | Controls the scroll behavior of an element. | \| [scroll-margin](https://tailwindcss.com/docs/scroll-margin) | Controls the scroll offset around items in a snap container. | \| [scroll-padding](https://tailwindcss.com/docs/scroll-padding) | Controls an element's scroll offset within a snap container. | \| [scroll-snap-align](https://tailwindcss.com/docs/scroll-snap-align) | Controls the scroll snap alignment of an element. | \| [scroll-snap-stop](https://tailwindcss.com/docs/scroll-snap-stop) | Controls whether you can skip past possible snap positions. | \| [scroll-snap-type](https://tailwindcss.com/docs/scroll-snap-type) | Controls how strictly snap points are enforced in a snap container. | # Stepper Divide and present content in sequenced steps. ## Using Components Optionally, you can substitute primitive data for components and props. # SVG Filters Apply filter effects to elements and images. ## How It Works This feature is enabled by [SVG filters](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/filter) paired with [feColorMatrix](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feColorMatrix) transformations. ## Usage Apply a filter to any element using the Filter style property and passing the unique SVG Filter ID. ```astro ... ``` We've provided a curated collection of SVG Filters to choose from below. ## Create a Filter We recommend [SVG Color Matrix Mixer](https://fecolormatrix.com/) by [Rik Schennink](https://x.com/rikschennink/) to create your own filters. ## Tips * The SVG must be in the same scope as the elements you wish to filter. Global scope is acceptable. * Consder storing your SVGs within your local project for quick and reusable imports. * All Vite-based frameworks support [SVG imports](https://vite.dev/guide/assets.html#importing-asset-as-url). * Optionally you can embed the SVG within a imported component (ex: `Apollo.svelte`, `Apollo.tsx`). * Filter SVGs are affected by the flow DOM, including class styles such as `space-{x|y}`. # Table of Contents Navigate the hierarchy of headings for the current page. ```astro --- interface PageHeadings { /** The text value within the heading tag; stripped of HTML. */ text: string; /** A generated slug value based on the text. */ slug: string; /** Depth indicates headings H1-H6. */ depth: number; } /** The generated list of page headings, slugs, and depth. */ const headings: PageHeadings[] = [ { text: 'Real World Example', slug: 'real-world-example', depth: 1 }, { text: 'Semantic Markup', slug: 'semantic-markup', depth: 1 }, { text: 'Utilities', slug: 'utilities', depth: 1 }, { text: 'Grid', slug: 'grid', depth: 2 }, { text: 'Alignment', slug: 'alignment', depth: 2 }, { text: 'Responsive Design', slug: 'responsive-design', depth: 2 }, { text: 'In Conclusion', slug: 'in-conclusion', depth: 1 }, ]; /** Provide a padding-left class based on the depth. */ function setIndentationClass(depth: number) { // prettier-ignore switch(depth) { case(6): { return 'pl-12'; } case(5): { return 'pl-10'; } case(4): { return 'pl-8'; } case(3): { return 'pl-6'; } case(2): { return 'pl-4'; } case(1): { return 'pl-2'; } default: { return 'pl-0'; } } } --- ``` ## Deep Linking Browsers allow you to deep link to any element via the ID. This is accomplished with an anchor tag and hashed (`#`) href value. When interacting with these anchors, the viewport will automatically attempt to scroll the `` element and bring the element into view. ```html

Some Example Heading

``` ```html Some Example Heading ``` > TIP: If you abstract scrolling away from the `` element, this will not work. ## Scroll Behavior You may optionally choose to implement a smooth [scroll behavior](https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior) using CSS. ```html ``` ```css body { scroll-behavior: smooth; } ``` ## Generate a Slug The following provides a barebones implementation for generating a slug based on a heading text value. ```ts function generateSlug(text: string, prefix?: string = '', suffix?: string = '') { // Format the slug from the text value. const slug = text .toLowerCase() .replaceAll(/[^a-zA-Z0-9 ]/g, '') .replaceAll(' ', '-') .toLowerCase(); // Note that you can optionally apply a prefix/suffix. return `${prefix}${slug}${suffix}`; } // Usage generateSlug('An Example Header'); // result: an-example-header generateSlug('An Example Header', 'skeleton-'); // result: skeleton-an-example-header generateSlug('An Example Header', '', '-skeleton'); // result: an-example-header-skeleton ``` ## Guides Specific instructions for generating headings will differ based on your meta-framework and your application architecture. Below are a few suggestions, but this is neither a definitive or exhaustive list of all available options. * [Astro](https://kld.dev/building-table-of-contents/) - enables you to automatically generate headings using built-in MDX features. * [Svelte](https://www.melt-ui.com/docs/builders/table-of-contents) - Melt UI provides a headless component solution for Svelte. * [Next.js](https://nextra.site/docs/docs-theme/theme-configuration#toc-sidebar) - Nextra provides a headless component solution for Next.js + MDX. * [Rehype Plugin](https://github.com/stefanprobst/rehype-extract-toc) - a general purpose Rehype plugin for generating a table of contents. # 1 - Setup & Usage Get Started with Skeleton. {

For best results, a{' '} Figma Professional Team Plan {' '} (or higher) is recommended.

} ## How to Install the Figma Library *** ## How to Use the Figma Library *** ## Guides # 2 - Import Themes Customize Your Design with Skeleton Themes ## Prerequisites * [Chapter 1: Set-up Skeleton Figma Library](chapter-1) *** ## Import Custom Theme *** ## Apply Custom Theme in Project ### Prerequisites * Completed [Chapter 1: Set-up Skeleton Figma Library](chapter-1#how-to-install-the-figma-library) * Completed [Chapter 2: Import Custom Theme](#import-custom-theme) *** ## Guides # 3 - Update Figma library Keep Your Skeleton Library Up to Date ## How to update the library *** ### Remove previous version After updating the Skeleton Figma library, please remove previous versions. Keeping multiple versions can create multiple copies of the same components, leading to design inconsistencies. Open the project that utilizes the old version of Skeleton v3 Figma UI library. Open `Assets`¹ tab and click on ² icon to open `Manage libraries` popup. In the `Libraries added to this file` section, click the `Remove`³ button next to the old version of the Skeleton v3 Figma UI library. *** ## Guides # Dark Mode Learn how to use Tailwind's dark mode feature for your Skeleton project. {

Skeleton makes use of{' '} Tailwind's Dark Mode {' '} to enable multiple strategies to control the overall app or page mode, as well as{' '} Color Scheme {' '} to selectively toggle light or dark interfaces at any scope.

} ## Dark Mode Tailwind [multiple strategies](https://tailwindcss.com/docs/dark-mode) for configuring Dark Mode. ### Media Strategy Enable by default. Uses CSS's [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) and sets the active mode based on operating system settings. ### Selector Strategy Activates dark mode by adding or removing the `.dark` class to your application's `` element. ```css title="app.css" @custom-variant dark (&:where(.dark, .dark *)); ``` ```html title="app.html" ... ``` ### Data Attribute Strategy Uses a data attribute instead of a class to activate dark mode. ```css title="app.css" @custom-variant dark (&:where([data-mode=dark], [data-mode=dark] *)); ``` ```html title="app.html" ... ``` ### Using the Dark Variant Apply a base style, then with Tailwind's `dark:` variant. ```html title="app.html"
...
``` *** ## Color Scheme Skeleton now supports Tailwind's [Color Scheme](https://tailwindcss.com/docs/color-scheme) feature, which enables toggling light or dark interfaces at any scope. By default, the scheme matches the current Dark Mode setting. This feature is enabled by [Color Pairings](/docs/design/colors#color-pairings), which implement the native CSS property [light-dark](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark). ```html
Light or Dark
Always Light Scheme
Always Dark Scheme
``` *** ## Light Switch Legacy versions of Skeleton offer a unique Light Switch component for controlling the Dark Mode `selector` strategy. Unfortunately this is no longer available due to the number of permutations required per framework and required feature capabilities, including: * Supporting one or more combinations of Dark Mode strategies. * Supporting the unique APIs of each meta-framework. * Handling state and persistence; ex: local vs remote vs account-based storage We now recommend you generate your own component following [Tailwind's best practices](https://tailwindcss.com/docs/dark-mode). To help you get started, we've provided a Cookbook recipe covering the basics. # Layouts Learn best practices for creating responsive layouts using semantic HTML and Tailwind. ## Real World Example See our real world three column example, which implements many of the concepts introduced below. ## Semantic Markup When creating custom layouts, it's recommended to use semantic HTML to denote each region of the page. \| Element | Description | Source | \| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | \| `
` | Represents introductory content, typically a group of introductory or navigational aids. It may contain some heading elements but also a logo, a search form, an author name, and other elements. | [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header) | \| `
` | Represents the dominant content within the document ``. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application. | [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main) | \| `