# Skeleton Documentation
## Get Started
# 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
{
Design System
This aims to augment Tailwind CSS. It provides themes, styled elements, and provides opinionated guardrails for integrating your fully
featured design system.
Components
Turnkey components built atop the foundation of{' '}
Zag.js
. These automatically adapt to the Skeleton design system out of the box. Currently available for Svelte and React.
}
## Our Philosophy
{
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.
Skeleton has maintained a frequent release cadence over for years. Just take a look at our{' '}
Releases
.
Community Tools
We promote community-based projects that help augment Skeleton and improve your productivity, such as the{' '}
Figma UI Kit
.
}
# Installation
Learn how to install and setup Skeleton for your project.
## Guides
doc.id.includes('installation/')} class="md:grid-cols-2" />
## 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.
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
Explore each pillar of the Skeleton design system. Provided via the Skeleton core.
doc.id.includes('design/')} class="md:grid-cols-2" />
***
## Tailwind Components
Tailwind components that act as primitives for creating complex interfaces. Provided via the Skeleton core.
doc.id.includes('tailwind-components/')} class="md:grid-cols-2" />
***
## Framework 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.
### Supported Frameworks
\| 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/).
View Zag.js
### Importing Components
You may import components per each Skeleton framework as follows.
```ts
import { Avatar } from '@skeletonlabs/skeleton-react';
```
This also includes access to the component prop types.
```ts
import type { AvatarRootProps, ... } from '@skeletonlabs/skeleton-react';
```
### 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 template within. Including: `required`, `data-*`, `style`, `className`, and more.
```tsx
export default function Avatar() {
return (
SK
);
}
```
### Styling Components
Skeleton components implement a universal convention for accepting CSS utility classes via the `className` attribute. Use this to pass any CSS utility class.
```tsx
export default function Avatar() {
return (
SK
);
}
```
By default, all internal styles are auto-prefixed to ensure they are assigned to the `@base` layer. This ensures any classes you pass through the `className` 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 to provide a custom element, this prop accepts a function which the `attributes` are passed into. Then spread the `attributes` to your custom elements. Note that this is an optional and advanced feature aimed at power users, and should not be needed for normal usage.
```tsx
export default function () {
return (
} />
Content for Item 1
);
}
```
### Custom Animations
Using the extensible markup pattern, you may implement custom animations. We showcase this below with [Motion](https://motion.dev/), but you could also use framework agnostic solutions such as [Anime.js](https://animejs.com/) or [Animate.css](https://animate.style/).
```tsx
import { Accordion } from '@skeletonlabs/skeleton-react';
import { motion, AnimatePresence } from 'motion/react';
export default function CustomAnimation() {
return (
{['1', '2', '3'].map((item) => (
Item {item}
(
{!attributes.hidden && (
Content for item {item}
)}
)}
/>
))}
);
}
```
1. Implement the `element` snippet to gain access to the `attributes`.
2. Spread the `attributes` to the custom element, a `
` in this example.
3. Wrap the custom element in Motion's ``.
4. Then implement conditional rendering that triggers animations when `attributes.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 underlying 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.
```tsx
import { Portal, Tooltip, useTooltip } from '@skeletonlabs/skeleton-react';
export default function TooltipExample() {
const tooltip = useTooltip();
return (
<>
AnchorContent
>
);
}
```
### 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.
View 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.
View Theme Properties
### 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
View Utilities
### Tailwind Components
Allow you to style semantic HTML elements with utility classes.
doc.id.includes('tailwind/')} class="md:grid-cols-2" />
## @variant
View Variants
### 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.
Browse Presets
### Preset Themes
Provides a hand curated set of themes for Skeleton.
Browse Themes
# Migrate from v2
Learn how to migrate from Skeleton v2 to the latest release.
This update represents a major overhaul to the Skeleton library. Including a ground up rewrite of every feature in the library. Note that some portions of this guide will be automated, while others require manual intervention. This is not a trivial migration from prior versions, so please ensure you follow this guide very carefully. This transition you through both the v3 and v4 updates.
## Prerequisites
While Skeleton v3 introduced 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 insight into the primary objectives for the overall migration process.
### 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
* 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 fully functional state before you proceed
***
## Migrate Core Technologies
Skeleton directly utilizes a number of core technologies. These must be migrated individually before proceeding with the Skeleton-specific migration. Note that Svelte and Tailwind provide dedicated CLIs to help automate this process. Please ensure you adhere to their individual migration guides linked below.
### Svelte v5
Migrate to the latest release of Svelte v5.
Svelte v5 Migration →
### SvelteKit v2
Migrate to the latest release of SvelteKit v2.
SvelteKit v2 Migration →
### Tailwind v4
Before migrating to Tailwind v4, please do the following:
1. Remove the `skeleton` plugin from your `tailwind.config` file.
2. Rename your `app.{postcss|pcss}` to `app.css`. Make sure to update layout imports too.
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`? Comment or remove the classes temporarily, run the migration CLI, then follow [these steps](/docs/\[framework]/get-started/migrate-from-v2#replacing-apply) to adapt to use native CSS properties and Tailwind's new utilities. Though ideally you should avoid the use of `@apply` going forward.
Tailwind v4 Migration →
#### Migrate to the Tailwind Vite Plugin
Use the following steps to migrate to from PostCSS to the Vite plugin:
1. Delete `postcss.config.{js|mjs}`
2. Run `npm uninstall postcss` (if present)
3. Run `npm uninstall @tailwindcss/postcss` (if present)
4. Run `npm install @tailwindcss/vite`
5. Open your `vite.config` in the root of your project
6. Include the following import: `import tailwindcss from '@tailwindcss/vite'`
7. Finally, add the Vite plugin above your framework plugin:
```ts
plugins: [
tailwindcss(),
sveltekit(), // or svelte()
];
```
> TIP: Please ensure you've committed all pending changes before proceeding.
***
## Automated Migration
We’ve provided a dedicated migration script as part of the Skeleton CLI to help automate much of this process.
First, run the following to migrate for Skeleton v3 changes:
```bash
npx skeleton migrate skeleton-3
```
Commit all pending changes. Then run the following to migrate for Skeleton v4 changes:
```bash
npx skeleton migrate skeleton-4
```
This migration WILL handle the following...
* 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 manual theme migration.
* Migrate all modified Skeleton utility classes (ex: `variant-*` to `preset-*`)
* Update all Skeleton imports throughout your entire project.
* Some Component imports will be pruned as they are no longer supported.
This migration WILL NOT...
* Adjust the component structure or component props. Unfortunately there’s too many permutations.
* Migrate Utility features (ex: popovers, code blocks, etc). See our recommendations below.
Make sure to consult your local Git Diff (difference) 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. The following is not optional.
### Update Stylesheet Imports
> NOTE: The Skeleton CLI will handle these for you, but please confirm.
In your global stylesheet (ex: `app.css`), the `@source` rules for sourcing component styles have been replaced with simpler and more intuitive `@import` rules.
```css
@source '../node_modules/@skeletonlabs/skeleton-{framework}/dist'; /* [!code --] */
@import '@skeletonlabs/skeleton-{framework}'; /* [!code ++] */
```
In Skeleton v3, canned [Preset styles](/docs/\[framework]/design/presets) were split to an optional stylesheet to allow them to be opt-in. However, due to popular demand, these have now been merged back into the core package in Skeleton v4. As such, you can remove this import.
```css
@import '@skeletonlabs/skeleton/optional/presets'; /* [!code --] */
```
### Migrate Themes
#### For Preset Themes
Your preset theme should be automatically migrated by the CLI. Refer to [Themes](/docs/\[framework]/design/themes#preset-themes) for more information.
#### 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 now sunset the ([troublesome](https://github.com/skeletonlabs/skeleton/issues/2383)) `` component in favor of user-defined custom layouts. We've provided a dedicated [Layouts](/docs/\[framework]/guides/layouts) guide for replicating common layout structures using only semantic HTML and Tailwind - no Skeleton specific features are required.
### Migrating Components
Components have undergone a major overhaul starting in Skeleton v3, with further refinements in Skeleton v4. Given the sheer number of changes, we recommend you compare each component to it's current production documentation.
#### Key Changes in v3
* 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.
#### Key Changes in v4
* Changes to adopt the newest [component conventions](/docs/\[framework]/resources/contribute/components)
* Changes to introduce new [component patterns](/docs/\[framework]/get-started/fundamentals#functional-components).
#### How to Migrate Components
The following showcases the process of migrating a single component.
**Was (v2)**
```svelte
```
**Now (v4)**
```svelte
SK
```
This was handled as follows:
1. We consulted the documentation for the [Avatar component](/docs/\[framework]/framework-components/avatar)
2. The Skeleton migration CLI will have handled all component imports automatically.
3. The root component `` remains; remove `src` and other unsupported props.
4. Now implements the new `` child and pass the `src` path and `alt` text.
5. Now implements the new `` child and pass a fallback value, icon, image, etc.
#### Tips for Component Migration
Until all components are migrated to the new format, they will throw errors when trying to run your local developement server. Use the following technique to update in a more progressive manner.
1. Use your editor of choice to search for Skeleton components via the import path (`@skeletonlabs/skeleton-svelte`)
2. Comment out each component one-by-one until all are disabled.
3. Consider adding messages such as `
(avatar)
` as visible placeholders for components on each page.
4. Uncomment each component individually as you migrate forward to the new syntax.
5. Once all components are migrated, you should no longer receive errors when running the dev server.
#### Renamed Components in v3
As part of the Skeleton v3 update, several components were renamed to be more semantic.
\| Name | v2 | v3 | Notes |
\| ------------------ | ----------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------- |
\| `` | [Link](https://v2.skeleton.dev/components/app-rail) | [Link](https:/skeleton.dev/docs/components/navigation/svelte) | Renamed `` - greatly expanded features |
\| `` | [Link](https://v2.skeleton.dev/components/file-buttons) | [Link](https:/skeleton.dev/docs/components/file-upload/svelte) | Renamed `` - merges `` features |
\| `` | [Link](https://v2.skeleton.dev/components/file-buttons) | [Link](https:/skeleton.dev/docs/components/file-upload/svelte) | Renamed `` - merges `` features |
\| `` | [Link](https://v2.skeleton.dev/components/input-chips) | [Link](https:/skeleton.dev/docs/components/tags-input/svelte) | Renamed `` |
\| `` | [Link](https://v2.skeleton.dev/components/paginators) | [Link](https:/skeleton.dev/docs/components/pagination/svelte) | Renamed `` |
\| `` | [Link](https://v2.skeleton.dev/components/progress-bars) | [Link](https:/skeleton.dev/docs/components/progress/svelte) | Renamed `