### Start Development Environment
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/plus.skeleton.dev/README.md
Starts the Docker container for the local database and OAuth server. This is the first step in the development setup.
```bash
pnpm env:start
```
--------------------------------
### Bash Commands for Installation and Development
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/plus.skeleton.dev/src/lib/remote/tutorials/kitchen-sink.md
Common bash commands for installing dependencies and starting a development server using pnpm. Essential for project setup.
```bash
pnpm install
pnpm dev
```
--------------------------------
### Default Button Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/buttons.mdx
Shows a basic button implementation. Use this as a starting point for custom buttons.
```astro
import Default from '@/components/examples/tailwind-components/buttons/default.astro';
import DefaultRaw from '@/components/examples/tailwind-components/buttons/default.astro?raw';
```
--------------------------------
### Install Skeleton UI
Source: https://github.com/skeletonlabs/skeleton/blob/main/packages/skeleton/README.md
Install the Skeleton UI library using pnpm.
```bash
pnpm add @skeletonlabs/skeleton
```
--------------------------------
### Install Skeleton React
Source: https://github.com/skeletonlabs/skeleton/blob/main/packages/skeleton-react/README.md
Install the Skeleton React library using pnpm.
```bash
pnpm add @skeletonlabs/skeleton-react
```
--------------------------------
### Install Skeleton Common
Source: https://github.com/skeletonlabs/skeleton/blob/main/packages/skeleton-common/README.md
Install the @skeletonlabs/skeleton-common package using pnpm.
```bash
pnpm add @skeletonlabs/skeleton-common
```
--------------------------------
### View Real World Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/guides/layouts.mdx
View a real-world three-column layout example implemented with Tailwind CSS.
```html
View Real World Example
```
--------------------------------
### Default React Iconography
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/iconography.mdx
Demonstrates the default setup for using icons in a React project. Ensure you have the necessary Lucide React package installed.
```tsx
import DefaultReact from '@/components/examples/design/iconography/react/default';
import DefaultReactRaw from '@/components/examples/design/iconography/react/default?raw';
```
--------------------------------
### User Generated Preset Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-utilities/presets.mdx
An example demonstrating the flexibility of creating custom presets by combining Skeleton and Tailwind utilities.
```astro
User Generated Preset
```
--------------------------------
### Install Component Types
Source: https://github.com/skeletonlabs/skeleton/blob/main/packages/docs/README.md
Install the component types package using pnpm.
```bash
pnpm add @skeletonlabs/component-types
```
--------------------------------
### Install Shiki
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/code-block.mdx
Install Shiki as a development dependency using npm.
```bash
npm install -D shiki
```
--------------------------------
### Install Dependencies with PNPM
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/resources/contribute/get-started.mdx
After forking and cloning the Skeleton monorepo, run this command from the root to install all necessary project dependencies.
```bash
pnpm i
```
--------------------------------
### Install Skeleton React Package
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/astro.mdx
Install the Skeleton UI package specifically for React projects.
```bash
@skeletonlabs/skeleton-react
```
--------------------------------
### Install Skeleton Packages
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/nextjs.mdx
Install the core Skeleton library and the React component package as development dependencies.
```bash
npm i -D @skeletonlabs/skeleton @skeletonlabs/skeleton-react
```
--------------------------------
### Start Development Server
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/plus.skeleton.dev/README.md
Runs the main development server after the environment and database schema are set up.
```bash
pnpm dev
```
--------------------------------
### Install Skeleton UI Packages
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/sveltekit.mdx
Install the core Skeleton UI package and the Svelte component package as development dependencies.
```bash
npm i -D @skeletonlabs/skeleton @skeletonlabs/skeleton-svelte
```
--------------------------------
### Default Preset Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-utilities/presets.mdx
Demonstrates the default Skeleton preset for general use.
```astro
Default Preset
```
--------------------------------
### Default Chip Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/chips.mdx
A basic example of a Tailwind CSS chip component.
```astro
import Default from '@/components/examples/tailwind-components/chips/default.astro';
import DefaultRaw from '@/components/examples/tailwind-components/chips/default.astro?raw';
```
--------------------------------
### Start Next.js Development Server
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/nextjs.mdx
Launch the development server for your Next.js application to view your changes.
```bash
npm run dev
```
--------------------------------
### Install Bits UI Package
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/bits-ui.mdx
Install the Bits UI package using npm. This is the first step to integrating Bits UI components.
```bash
npm install bits-ui
```
--------------------------------
### Input Preset Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-utilities/presets.mdx
Demonstrates using presets to create custom validation classes for input fields.
```astro
```
--------------------------------
### Default App Bar Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/app-bar.mdx
Displays a standard App Bar. Use this for a basic header.
```svelte
```
--------------------------------
### Install Skeleton Svelte Package
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/astro.mdx
Install the Skeleton UI package specifically for Svelte projects.
```bash
@skeletonlabs/skeleton-svelte
```
--------------------------------
### Install Floating UI
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/guides/cookbook/floating-ui-attachments.mdx
Install the standard version of Floating UI using npm. This is the first step before integrating it into your Svelte project.
```bash
npm install @floating-ui/dom
```
--------------------------------
### Install Skeleton Svelte
Source: https://github.com/skeletonlabs/skeleton/blob/main/packages/skeleton-svelte/README.md
Use this command to add the Skeleton Svelte library to your project.
```bash
pnpm add @skeletonlabs/skeleton-svelte
```
--------------------------------
### Install Melt UI Package
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/melt-ui.mdx
Install the Melt UI package using npm. Ensure you have a SvelteKit project set up with Skeleton v3 and Tailwind v4.
```bash
npm install melt
```
--------------------------------
### Install Radix UI Toggle Group
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/radix-ui.mdx
Install the Radix UI toggle group component package using npm.
```bash
npm install @radix-ui/react-toggle-group
```
--------------------------------
### Complete Melt UI Accordion Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/melt-ui.mdx
A full Svelte component example demonstrating Melt UI's Accordion builder with multiple items, styles, and transitions.
```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}
```
--------------------------------
### Install Internationalized Date Package
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/bits-ui.mdx
Install the Adobe Internationalized Date package for date and time formatting assistance.
```bash
npm i -D @internationalized/date
```
--------------------------------
### Default Mask Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-utilities/masks.mdx
Demonstrates the default mask application. This snippet shows a basic usage of the mask utility.
```astro
import Default from '@/components/examples/tailwind-utilities/masks/default.svelte';
```
--------------------------------
### Complete Bits UI Calendar Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/bits-ui.mdx
A full Svelte component example demonstrating the integration of the Bits UI Calendar component with custom styling and functionality. It includes date unavailability logic and binds the selected date.
```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}
```
--------------------------------
### Add Astro Framework Packages
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/astro.mdx
Install the Astro framework integration for Svelte. Ensure you have the correct Astro version installed.
```bash
npx astro add svelte
```
--------------------------------
### Default Pagination Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/pagination.mdx
Basic implementation of the Pagination component. Use this for standard client-side pagination.
```svelte
```
--------------------------------
### Glass Preset Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-utilities/presets.mdx
Illustrates applying special effects like backdrop blur to presets for a glass-like appearance.
```astro
Glass Preset
```
--------------------------------
### React Toggle Layout Navigation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/navigation.mdx
Example demonstrating dynamic layout switching using reactive state for navigation components in React. Allows toggling between layouts via an icon.
```tsx
import { Skeleton } from '@skeletonlabs/skeleton';
import type { Custom } from 'svelte/types/runtime/transition';
export default function ToggleReact() {
return (
);
}
```
--------------------------------
### Default Popover Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/popover.mdx
Demonstrates the default usage of the Popover component in React. This example shows a basic implementation without custom styling.
```tsx
import { Popover, PopoverTrigger, PopoverContent, Button } from '@skeletonlabs/skeleton';
function DefaultPopover() {
return (
Popover Content
);
}
export default DefaultPopover;
```
--------------------------------
### Default Popover Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/popover.mdx
Demonstrates the default usage of the Popover component in Svelte. This example shows a basic implementation without custom styling.
```svelte
Popover Content
```
--------------------------------
### Add Astro Framework Packages
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/astro.mdx
Install the Astro framework integration for React. Ensure you have the correct Astro version installed.
```bash
npx astro add react
```
--------------------------------
### Install Skeleton CLI
Source: https://github.com/skeletonlabs/skeleton/blob/main/packages/cli/README.md
Use this command to add the Skeleton CLI to your project dependencies.
```bash
pnpm add skeleton
```
--------------------------------
### Install Skeleton Core Package
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/other.mdx
Use this command to install the Skeleton core package via npm. This provides access to most features, excluding components.
```bash
npm i -D @skeletonlabs/skeleton
```
--------------------------------
### Default App Bar Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/app-bar.mdx
Displays a standard App Bar. Use this for a basic header.
```tsx
import { AppBar } from '@skeletonlabs/skeleton-react';
export default function Default() {
return (
);
}
```
--------------------------------
### React Navigation Bar Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/navigation.mdx
Example of a default navigation bar component for React. Recommended for small screens and vertical layouts.
```tsx
import { Skeleton } from '@skeletonlabs/skeleton';
import type { Custom } from 'svelte/types/runtime/transition';
export default function DefaultReact() {
return (
);
}
```
--------------------------------
### Svelte Navigation Bar Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/navigation.mdx
Example of a default navigation bar component for Svelte. Recommended for small screens and vertical layouts.
```svelte
```
--------------------------------
### Default Dialog Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/dialogs.mdx
Demonstrates a basic dialog component in Svelte. Use this for standard modal interactions.
```svelte
```
--------------------------------
### React Sidebar Navigation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/navigation.mdx
Example of a sidebar navigation component for React. Recommended for large screens and horizontal layouts with deep navigation.
```tsx
import { Skeleton } from '@skeletonlabs/skeleton';
import type { Custom } from 'svelte/types/runtime/transition';
export default function SidebarReact() {
return (
);
}
```
--------------------------------
### Navigation Tabs Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/tabs.mdx
Demonstrates using the `element` slot to integrate navigation tabs with `a` tags in React.
```jsx
import { Tabs } from '@skeletonlabs/skeleton';
let tabsData = [
{
label: 'Tab 1',
content: 'Tab 1 Content',
// Use 'element' to override the default button with an anchor tag
element: 'a',
// Add href for navigation
href: '#tab1'
},
{
label: 'Tab 2',
content: 'Tab 2 Content',
element: 'a',
href: '#tab2'
},
{
label: 'Tab 3',
content: 'Tab 3 Content',
element: 'a',
href: '#tab3'
}
];
```
--------------------------------
### React Component Part File Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/resources/contribute/components.mdx
Example of a React component part file, exporting the component as default and its props as named exports. Includes `AvatarRootProps` interface.
```tsx
export interface AvatarRootProps {
// ...
}
export default function Root(props: AvatarRootProps) {
// ...
}
```
--------------------------------
### Non-Modal Dialog Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/dialogs.mdx
Use `show()` instead of `showModal()` for non-modal dialogs that open without a backdrop or top-layer placement, similar to a tooltip. This example is in Svelte.
```svelte
```
--------------------------------
### Default Tabs Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/tabs.mdx
Demonstrates the default appearance and behavior of the Tabs component in Svelte.
```svelte
```
--------------------------------
### Navigation Tabs Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/tabs.mdx
Demonstrates using the `element` slot to integrate navigation tabs with `a` tags in Svelte.
```svelte
```
--------------------------------
### Default Toast Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/toast.mdx
Displays a basic toast message. Use this for simple notifications.
```jsx
import { toast } from "skeleton-ui";
export default function App() {
return (
);
}
```
--------------------------------
### Default Carousel Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/carousel.mdx
Demonstrates the basic usage of the Carousel component with default settings.
```svelte
```
--------------------------------
### Run Development Server
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/migrate-from-v2.mdx
Execute this command to start your application's local development server after completing migration steps.
```bash
npm run dev
```
--------------------------------
### Default Carousel Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/carousel.mdx
Demonstrates the basic usage of the Carousel component with default settings.
```tsx
import { Carousel } from '@skeletonlabs/skeleton-react';
export default function Anatomy() {
return (
);
}
```
--------------------------------
### React Page Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/code-block.mdx
Demonstrates using the React code block component within a Next.js page.
```typescript
import React from 'react';
import ReactPage from '@/components/examples/integrations/code-block/react/page';
const Page: React.FC = () => {
return ;
};
export default Page;
```
--------------------------------
### Svelte Component Part File Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/resources/contribute/components.mdx
Example of a Svelte component part file, exporting the component as default and its props as named exports. Includes `AvatarRootProps` interface and `$props()` usage.
```svelte
```
--------------------------------
### Melt UI Accordion Component Boilerplate
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/melt-ui.mdx
Create a Svelte component for the Melt UI Accordion. This example shows the basic structure and data setup for an unstyled Accordion.
```svelte
{#each items as i}
{@const item = accordion.getItem(i)}
{item.item.description}
{/each}
```
--------------------------------
### Default Tabs Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/tabs.mdx
Demonstrates the default appearance and behavior of the Tabs component in React.
```jsx
import { Tabs } from '@skeletonlabs/skeleton';
let tabsData = [
{
label: 'Tab 1',
content: 'Tab 1 Content'
},
{
label: 'Tab 2',
content: 'Tab 2 Content'
},
{
label: 'Tab 3',
content: 'Tab 3 Content'
}
];
```
--------------------------------
### Superscript Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Renders text in superscript, typically raised and reduced in size.
```astro
```
--------------------------------
### Initially Open Disclosure Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/disclosures.mdx
Illustrates how to make a disclosure component visible by default by adding the `open` attribute.
```astro
import Open from '@/components/examples/tailwind-components/disclosures/open.astro';
import OpenRaw from '@/components/examples/tailwind-components/disclosures/open.astro?raw';
```
--------------------------------
### Keyboard Input Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Represents textual user input from a keyboard, voice, or other input device.
```astro
```
--------------------------------
### Default Pagination Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/pagination.mdx
Basic implementation of the Pagination component. Use this for standard client-side pagination.
```tsx
import { Pagination } from '@skeletonlabs/skeleton-react';
export default function Default() {
return (
);
}
```
--------------------------------
### Default Toast Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/toast.mdx
Displays a basic toast message in Svelte. Use this for simple notifications.
```svelte
```
--------------------------------
### Stop Development Environment
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/plus.skeleton.dev/README.md
Shuts down the Docker container that was started with `pnpm env:start`.
```bash
pnpm env:stop
```
--------------------------------
### Chip Presets Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/chips.mdx
Shows how to use presets for Tailwind CSS chip components, referencing the presets utility documentation.
```astro
import Presets from '@/components/examples/tailwind-components/chips/presets.astro';
import PresetsRaw from '@/components/examples/tailwind-components/chips/presets.astro?raw';
```
--------------------------------
### Svelte Progress Linear Orientation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/progress-linear.mdx
Demonstrates controlling the layout orientation of the Progress Linear component in Svelte.
```svelte
```
--------------------------------
### Svelte Page Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/code-block.mdx
Demonstrates using the Svelte code block component within a SvelteKit page.
```svelte
```
--------------------------------
### React Progress Linear Height Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/progress-linear.mdx
Demonstrates how to use different heights for the Progress Linear component in React.
```tsx
import { Progress } from '@skeletonlabs/skeleton-react';
export default function Height() {
return (
);
}
```
--------------------------------
### Gradient Preset Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-utilities/presets.mdx
Shows how to leverage Tailwind's gradient utility classes within custom presets for visually appealing elements.
```astro
Gradient Preset
```
--------------------------------
### Default Dialog Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/dialogs.mdx
Demonstrates a basic dialog component in React. Use this for standard modal interactions.
```tsx
import { useState } from 'react';
export default function DefaultDialog() {
const [open, setOpen] = useState(false);
return (
<>
>
);
}
```
--------------------------------
### React Progress Linear Orientation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/progress-linear.mdx
Demonstrates controlling the layout orientation of the Progress Linear component in React.
```tsx
import { Progress } from '@skeletonlabs/skeleton-react';
export default function Orientation() {
return (
);
}
```
--------------------------------
### Toast Group Setup (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/toast.mdx
Implement a single instance of `` in your application's root scope. Requires a toaster instance.
```svelte
{@render props.children?.()}
{#snippet children(toast)}
{toast.title}{toast.description}
{/snippet}
```
--------------------------------
### Svelte Progress Linear Height Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/progress-linear.mdx
Demonstrates how to use different heights for the Progress Linear component in Svelte.
```svelte
```
--------------------------------
### Default Switch Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/switch.mdx
A basic implementation of the Switch component in Svelte. This shows the default appearance and functionality.
```svelte
```
--------------------------------
### Run Automated Migration
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/migrate-from-v3.mdx
Initiate the migration process using the Skeleton CLI. This handles package and stylesheet updates.
```bash
npx skeleton@latest migrate skeleton-4
```
--------------------------------
### Install Tailwind CSS
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/vite-react.mdx
Install Tailwind CSS and its Vite plugin. Ensure the Tailwind plugin is added to vite.config.ts after React.
```bash
npm install tailwindcss @tailwindcss/vite
```
```typescript
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; // [!code ++]
export default defineConfig({
plugins: [
tailwindcss(), // [!code ++]
react() // <-- Must come after Tailwind
],
});
```
--------------------------------
### React Navigation Rail Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/navigation.mdx
Example of a navigation rail component for React. Recommended for medium screens and horizontal layouts.
```tsx
import { Skeleton } from '@skeletonlabs/skeleton';
import type { Custom } from 'svelte/types/runtime/transition';
export default function RailReact() {
return (
);
}
```
--------------------------------
### Svelte Default Clipboard Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/guides/cookbook/clipboard.mdx
Demonstrates basic programmatic clipboard access in Svelte. Ensure the component is client-side rendered.
```svelte
```
--------------------------------
### Install Custom Font with npm
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/themes.mdx
Install a font package, such as Open Sans, from Fontsource using npm. This is a prerequisite for using custom fonts in your project.
```bash
npm install @fontsource/open-sans
```
--------------------------------
### Default Menu Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/menu.mdx
Demonstrates the basic usage of the Menu component in React. This snippet shows how to render a simple, functional menu.
```jsx
import {
Menu,
MenuTrigger,
MenuItem,
MenuHeading,
MenuSeparator,
MenuLabel
} from "@skeletonlabs/skeleton";
let open = false;
```
--------------------------------
### Alert Dialog Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/dialogs.mdx
Use `role="alertdialog"` for dialogs that interrupt the user with a message requiring a response. This example is in Svelte.
```svelte
```
--------------------------------
### Alert Dialog Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/dialogs.mdx
Use `role="alertdialog"` for dialogs that interrupt the user with a message requiring a response. This example is in React.
```tsx
import { useState } from 'react';
export default function AlertDialog() {
const [open, setOpen] = useState(false);
return (
<>
>
);
}
```
--------------------------------
### Fluid Width Tabs Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/tabs.mdx
Shows how to make tabs stretch to fill container width using flex utility classes in Svelte.
```svelte
```
--------------------------------
### Install Tailwind CSS and Vite Plugin
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/vite-svelte.mdx
Install Tailwind CSS and its Vite plugin. Then, implement the plugin in your vite.config.ts file, ensuring it comes before the Svelte plugin.
```bash
npm install tailwindcss @tailwindcss/vite
```
```typescript
import { defineConfig } from "vite";
import svelte from "@vitejs/plugin-svelte";
import tailwindcss from "@tailwindcss/vite"; // [!code ++]
export default defineConfig({
plugins: [
tailwindcss(), // [!code ++]
svelte() // <-- Must come after Tailwind
],
});
```
--------------------------------
### Create a New SvelteKit Project
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/sveltekit.mdx
Use the Svelte CLI to generate a new SvelteKit project with TypeScript support. Navigate into the project directory afterwards.
```bash
npx sv create --types ts my-skeleton-app
cd my-skeleton-app
```
--------------------------------
### Create Next.js Project
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/nextjs.mdx
Scaffold a new Next.js project using npm. Navigate into the newly created directory.
```bash
npm create next-app@latest my-skeleton-app
cd my-skeleton-app
```
--------------------------------
### Color Pairing Utility Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/colors.mdx
Illustrates the condensed syntax for dual-tone color values that swap between light and dark modes. Useful for elements requiring distinct appearances in different lighting conditions.
```html
...
...
```
--------------------------------
### Non-Modal Dialog Example (React)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/dialogs.mdx
Use `show()` instead of `showModal()` for non-modal dialogs that open without a backdrop or top-layer placement, similar to a tooltip. This example is in React.
```tsx
import { useRef } from 'react';
export default function NonModalDialog() {
const dialogRef = useRef(null);
return (
<>
>
);
}
```
--------------------------------
### Default Menu Example (Svelte)
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/menu.mdx
Demonstrates the basic usage of the Menu component in Svelte. This snippet shows how to render a simple, functional menu.
```svelte
```
--------------------------------
### Complete Radix ToggleGroup Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/integrations/radix-ui.mdx
A full example of the Radix ToggleGroup component integrated with Skeleton, including state management using useState for controlled component behavior.
```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
);
};
```
--------------------------------
### HTML Icon Sizing Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/iconography.mdx
Demonstrates how to apply size utility classes to icons and related elements within an HTML structure. This approach aligns with Tailwind CSS conventions.
```html
...
```
--------------------------------
### Development Server Commands
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/resources/contribute/components.mdx
Commands to run development servers for different Skeleton projects. Use `pnpm` for package management.
```bash
pnpm doc dev
pnpm themes dev
pnpm react dev
pnpm svelte dev
```
--------------------------------
### Quotation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Represents a short inline quotation.
```astro
```
--------------------------------
### Create Astro Project with Tailwind
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/installation/astro.mdx
Use this command to scaffold a new Astro project with Tailwind CSS pre-configured. Navigate into the new project directory afterward.
```bash
npm create astro@latest --add tailwind my-skeleton-app
cd my-skeleton-app
```
--------------------------------
### Default Disclosure Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/tailwind-components/disclosures.mdx
Demonstrates the basic usage of a disclosure component.
```astro
import Default from '@/components/examples/tailwind-components/disclosures/default.astro';
import DefaultRaw from '@/components/examples/tailwind-components/disclosures/default.astro?raw';
```
--------------------------------
### Time Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Represents a specific period in time or a machine-readable date.
```astro
```
--------------------------------
### Run Skeleton v3 Migration
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/get-started/migrate-from-v2.mdx
Execute the Skeleton CLI to migrate your project for v3 changes. Ensure all pending changes are committed before proceeding.
```bash
npx skeleton@latest migrate skeleton-3
```
--------------------------------
### Subscript Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Renders text in subscript, typically lowered and reduced in size.
```astro
```
--------------------------------
### React Default Clipboard Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/guides/cookbook/clipboard.mdx
Demonstrates basic programmatic clipboard access in React. Ensure the component is client-side rendered.
```tsx
import { createEffect, onMount } from 'solid-js';
export default function DefaultReact(props) {
let element;
const write = async () => {
await navigator.clipboard.writeText('Hello World!');
};
const read = async () => {
const text = await navigator.clipboard.readText();
console.log('Pasted content: ', text);
};
onMount(() => {
element.addEventListener('click', () => {
write();
read();
});
});
return (
);
}
```
--------------------------------
### Citation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
References the title of a creative work, such as a book, article, or film.
```astro
```
--------------------------------
### Blockquote Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Indicates an extended quotation set apart from surrounding content.
```astro
```
--------------------------------
### Abbreviation Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Represents an abbreviation or acronym, optionally paired with its full expansion.
```astro
```
--------------------------------
### Popover Usage Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/guides/cookbook/floating-ui-attachments.mdx
Demonstrates how to implement a basic popover using the custom Floating UI attachment in Svelte. Includes trigger and popover elements with necessary directives.
```svelte
{#if popover.isOpen()}
Popover Content
{/if}
```
--------------------------------
### Insert & Delete Text Example
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/design/typography.mdx
Marks text that has been added to or removed from a document.
```astro
```
--------------------------------
### React Portal Usage
Source: https://github.com/skeletonlabs/skeleton/blob/main/sites/skeleton.dev/src/content/docs/framework-components/portal.mdx
Demonstrates the basic usage of the Portal component in React. Import Portal and wrap your content within it.
```tsx
import { Portal } from '@skeletonlabs/skeleton-react';
export default function Anatomy() {
return {/* Content */};
}
```