- get started
- ›
- fundamentals
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 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 and utilize it for all examples in our documentation. Refer to our integration guides for React and 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 a number of select component frameworks. Each component automatically adapt to Skeleton’s design system.
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 - the creator and core maintainer for Chakra UI, Ark UI, and PandaCSS.
View Zag.js
Importing Components
You may import components per each Skeleton framework as follows.
import { Avatar } from '@skeletonlabs/skeleton-{react|svelte}';
This also includes access to the component prop types.
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.
<Avatar> <Avatar.Image src="https://i.pravatar.cc/150?img=48" /> <Avatar.Fallback>SK</Avatar.Fallback></Avatar>
Styling Components
Skeleton components implement a universal convention for accepting CSS utility classes via the class
attribute. Use this to pass any Tailwind or Skeleton utility class.
<Avatar class="rounded-2xl"> <Avatar.Image src="https://i.pravatar.cc/150?img=48" class="greyscale" /> <Avatar.Fallback>SK</Avatar.Fallback></Avatar>
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.
@custom-variant skb { @layer base { @slot; }}
Extensible Markup
Skeleton components provide a mechasism 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 should not be needed for normal usage.
React:
export default function () { return ( <Accordion> {/* ... */} <Accordion.Item value="item-1"> <Accordion.Heading> <Accordion.Trigger element={({ attributes }) => <button {...attributes}>My Own Button</button>} /> <Accordion.Content>Content for Item 1</Accordion.Content> </Accordion.Heading> </Accordion.Item> {/* ... */} </Accordion> );}
Svelte:
<Accordion> <!-- ... --> <Accordion.Item value="item-1"> <Accordion.Heading> <Accordion.Trigger> {#snippet element({ attributes })} <button {...attributes}>My Own Button</button> {/snippet} </Accordion.Trigger> <Accordion.Content>Content for Item 1</Accordion.Content> </Accordion.Heading> </Accordion.Item> <!-- ... --></Accordion>
Custom Animations
Using the extensible markup pattern, you may implement custom animations. While we showcase this below with Svelte Transitions, but you could also use framework agnostic solutions such as Motion, Anime.js, or Animate.css.
import { slide } from 'svelte/transition';
<Accordion> <!-- ... --> <Accordion.Item value="item-1"> <Accordion.Heading> <Accordion.Trigger>Item 1</Accordion.Trigger> <Accordion.Content> {#snippet element({ attributes })} {#if attributes.hidden !== true} <div {...attributes} hidden={false} transition:slide={{ duration: 100 }}>Content 1</div> {/if} {/snippet} </Accordion.Content> </Accordion.Heading> </Accordion.Item> <!-- ... --></Accordion>
- Implement the
element()
snippet to gain access to theattributes
. - Spread the
attributes
to the custom element, a<div>
in this example. - Override the
hidden
attribute tofalse
to prevent it from showing/hiding the element too soon. - Add the
transition:slide
and configure your preferred options. - Then implement the wrapping
#if
block that triggers transitions whenattribute.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.
<script lang="ts"> import { Portal, Tooltip, useTooltip } from '@skeletonlabs/skeleton-svelte';
const id = $props.id(); const tooltip = useTooltip({ id });</script>
<!-- External trigger using the Zag.js `open` state and `setOpen()` method --><button type="button" onclick={() => tooltip().setOpen(!tooltip().open)}>Trigger</button>
<!-- Tooltip provider and reference value --><Tooltip.Provider value={tooltip}> <Tooltip.Trigger>Anchor</Tooltip.Trigger> <Portal> <Tooltip.Positioner> <Tooltip.Content>Content</Tooltip.Content> </Tooltip.Positioner> </Portal></Tooltip.Provider>
Learn More
For a comprehensive guide to how Skeleton implements components, refer to our contribution guidelines.