npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@classic-homes/theme-svelte

v0.1.26

Published

Svelte components for the Classic theme system

Downloads

2,609

Readme

@classic-homes/theme-svelte

Svelte 5 components for the Classic Theme design system. Built on Bits UI primitives and styled with Tailwind CSS.

Installation

npm install @classic-homes/theme-svelte @classic-homes/theme-tokens

Setup

1. Configure Tailwind CSS

Add the Classic Theme preset to your tailwind.config.js:

import preset from '@classic-homes/theme-tailwind-preset';

export default {
  presets: [preset],
  content: [
    './src/**/*.{html,js,svelte,ts}',
    './node_modules/@classic-homes/theme-svelte/**/*.{html,js,svelte,ts}',
  ],
};

2. Import Design Tokens

Import the CSS tokens in your app's root CSS file:

@import '@classic-homes/theme-tokens/css';

Or in your root layout:

<script>
  import '@classic-homes/theme-tokens/css';
</script>

Usage

<script>
  import { Button, Card, CardHeader, CardTitle, CardContent } from '@classic-homes/theme-svelte';
</script>

<Card>
  <CardHeader>
    <CardTitle>Welcome</CardTitle>
  </CardHeader>
  <CardContent>
    <Button variant="default">Click me</Button>
  </CardContent>
</Card>

Components

Core UI

  • Button - Buttons with variants (default, secondary, destructive, outline, ghost, link)
  • Input - Text input field
  • Textarea - Multi-line text input
  • Label - Form labels
  • Checkbox - Checkbox input
  • Switch - Toggle switch
  • Select - Dropdown select
  • FormField - Combined label + input + error handling

Layout

  • AppShell - Application wrapper with skip links and toast container
  • DashboardLayout - Sidebar + header layout for dashboards
  • PublicLayout - Header + footer layout for public pages
  • FormPageLayout - Centered form page layout
  • Sidebar - Navigation sidebar
  • Header - Page header
  • Footer - Page footer

Feedback

  • Alert - Alert messages (default, destructive, success, warning, info)
  • AlertDialog - Confirmation dialogs
  • Dialog - Modal dialogs
  • Toast - Toast notifications
  • ToastContainer - Toast notification container
  • Spinner - Loading spinner
  • Skeleton - Loading skeleton

Data Display

  • Card - Card container with header, content, footer
  • Badge - Status badges
  • DataTable - Sortable data table
  • Tabs - Tab navigation
  • Tooltip - Hover tooltips
  • DropdownMenu - Dropdown menus
  • Avatar - User avatars

Branding

  • LogoMain - Main logo component
  • LoadingLogo - Animated loading logo

Error Handling

Overview

Components in this library do not include built-in error boundaries to give you full control over error handling. We recommend implementing error handling at your application's root level.

Recommended: Error Boundary Component

Create an ErrorBoundary component to catch and handle errors gracefully:

<!-- src/lib/ErrorBoundary.svelte -->
<script lang="ts">
  import type { Snippet } from 'svelte';
  import { Button, Alert, AlertDescription } from '@classic-homes/theme-svelte';

  interface Props {
    children: Snippet;
    fallback?: Snippet<[Error, () => void]>;
  }

  let { children, fallback }: Props = $props();
  let error = $state<Error | null>(null);

  function reset() {
    error = null;
  }

  $effect(() => {
    const handleError = (e: ErrorEvent) => {
      e.preventDefault();
      error = e.error || new Error(e.message);
    };

    const handleUnhandledRejection = (e: PromiseRejectionEvent) => {
      e.preventDefault();
      error = e.reason instanceof Error ? e.reason : new Error(String(e.reason));
    };

    window.addEventListener('error', handleError);
    window.addEventListener('unhandledrejection', handleUnhandledRejection);

    return () => {
      window.removeEventListener('error', handleError);
      window.removeEventListener('unhandledrejection', handleUnhandledRejection);
    };
  });
</script>

{#if error}
  {#if fallback}
    {@render fallback(error, reset)}
  {:else}
    <div class="flex min-h-screen items-center justify-center p-4">
      <div class="w-full max-w-md space-y-4">
        <Alert variant="destructive">
          <AlertDescription>
            <strong>Something went wrong</strong>
            <p class="mt-2 text-sm">{error.message}</p>
          </AlertDescription>
        </Alert>
        <Button onclick={reset} variant="outline" class="w-full">Try again</Button>
      </div>
    </div>
  {/if}
{:else}
  {@render children()}
{/if}

Usage with AppShell

Wrap your AppShell with the ErrorBoundary:

<!-- src/routes/+layout.svelte -->
<script>
  import { AppShell } from '@classic-homes/theme-svelte';
  import ErrorBoundary from '$lib/ErrorBoundary.svelte';
</script>

<ErrorBoundary>
  <AppShell>
    <slot />
  </AppShell>
</ErrorBoundary>

Custom Fallback UI

You can provide a custom fallback UI:

<ErrorBoundary>
  {#snippet fallback(error, reset)}
    <div class="error-page">
      <h1>Oops!</h1>
      <p>{error.message}</p>
      <button onclick={reset}>Reload</button>
    </div>
  {/snippet}

  <AppShell>
    <slot />
  </AppShell>
</ErrorBoundary>

Toast Notifications

The library includes a toast store for managing notifications:

<script>
  import { toastStore, Button } from '@classic-homes/theme-svelte';

  function showSuccess() {
    toastStore.success('Operation completed successfully!');
  }

  function showError() {
    toastStore.error('Something went wrong', { title: 'Error' });
  }
</script>

<Button onclick={showSuccess}>Show Success</Button>
<Button onclick={showError} variant="destructive">Show Error</Button>

Toast methods:

  • toastStore.success(message, options?) - Green success toast
  • toastStore.error(message, options?) - Red error toast (persistent by default)
  • toastStore.warning(message, options?) - Yellow warning toast
  • toastStore.info(message, options?) - Blue info toast
  • toastStore.add(toast) - Add custom toast
  • toastStore.remove(id) - Remove toast by ID
  • toastStore.clear() - Remove all toasts

Sidebar State

For layouts with collapsible sidebars, use the sidebar store:

<script>
  import { sidebarStore } from '@classic-homes/theme-svelte';

  function toggleSidebar() {
    sidebarStore.toggle();
  }
</script>

<button onclick={toggleSidebar}>
  {sidebarStore.isOpen ? 'Close' : 'Open'} Sidebar
</button>

TypeScript Support

All components are fully typed. Import types as needed:

import type {
  NavItem,
  NavSection,
  User,
  Tab,
  FileMetadata,
  DataTableColumn,
  SelectOption,
} from '@classic-homes/theme-svelte';

Svelte 5 Runes

All components use Svelte 5 runes syntax:

  • $props() for component props
  • $state() for reactive state
  • $derived() for computed values
  • $effect() for side effects
  • $bindable() for two-way binding

Accessibility

Components are built with accessibility in mind:

  • Proper ARIA attributes
  • Keyboard navigation support
  • Focus management
  • Screen reader friendly
  • Skip links in AppShell

License

MIT