A plug-and-play collapsible sidebar component for Svelte 5 and Skeleton UI. This component provides a resizable and collapsible sidebar that can be positioned on any side of your application.
npm install svelte-skeleton-collapsible-sidebar
# or
yarn add svelte-skeleton-collapsible-sidebar
# or
pnpm add svelte-skeleton-collapsible-sidebar
<script>
import CollapsibleSidebar from 'svelte-skeleton-collapsible-sidebar';
</script>
<CollapsibleSidebar>
<!-- Your sidebar content here -->
</CollapsibleSidebar>
Prop | Type | Default | Description |
---|---|---|---|
side |
'left' | 'right' | 'top' | 'bottom' |
'left' |
Position of the sidebar |
minSize |
number |
150 |
Minimum size in pixels |
maxSize |
number |
800 |
Maximum size in pixels |
startSize |
number |
300 |
Initial size in pixels |
collapsedSize |
number |
40 |
Size when collapsed in pixels |
title |
string |
'' |
Title shown when sidebar is collapsed |
isCollapsed |
boolean |
false |
Initial collapse state |
<CollapsibleSidebar side="left" title="Navigation">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
</CollapsibleSidebar>
<CollapsibleSidebar
side="right"
startSize={250}
minSize={100}
maxSize={500}
title="Settings"
>
<!-- Settings content -->
</CollapsibleSidebar>
<script>
let sidebarCollapsed = false;
</script>
<CollapsibleSidebar bind:isCollapsed={sidebarCollapsed}>
<!-- Content -->
</CollapsibleSidebar>
The component uses Skeleton UI's theming system and includes these default classes:
bg-surface-100-800-token
for backgroundborder-surface-500/30
for bordersvariant-soft
for the collapse/expand buttonYou can override these using Skeleton UI's theming system or by adding custom CSS.
MIT License - see LICENSE for details
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please file an issue on the GitHub repository.