/`

Design System / Component Library

Template Preview

Logo

🎨 DesignSystem Name

A themeable, accessible React component library for your product family.

npm version Storybook Accessibility License

📑 Table of Contents


🧾 About

Tagline — One sentence describing what this library provides.

2–3 sentences: what products consume this library, what consistency problem it solves, and who maintains it.

Example:

DesignSystem Name is the shared component library and visual language for all web products at CompanyName. It replaces ad-hoc component duplication across four apps with a single, versioned source of truth — so a button change ships everywhere at once, and every product automatically passes accessibility audits.


⚙️ How It Works

Design Tokens (colors, spacing, typography)
        │
        ▼
Base Components (built on Radix UI primitives)
        │
        ▼
Composed Components (Form, DataTable, Modal...)
        │
        ▼
ThemeProvider (injects CSS custom properties at runtime)
        │
        ▼
Consumer App wraps in <ThemeProvider> → consistent UI
  1. Tokens: Design decisions are encoded as CSS custom properties, not hardcoded values in components.
  2. Primitives: Low-level components handle accessibility (ARIA, keyboard nav) via Radix UI.
  3. Composed Components: Higher-level components combine primitives for common patterns (forms, tables, modals).
  4. Theming:
    ThemeProvider
    swaps the token values at runtime — dark mode, custom brand colors, and whitelabeling all work the same way.

💼 Real-World Use Cases

  • Multi-product Companies: A shared library means the same Button renders identically across the marketing site, the app, and the admin dashboard — with no copy-paste.
  • Design-Dev Handoff: Designers define tokens in Figma; developers consume the same values via CSS custom properties. No more "that's not quite the right shade of blue."
  • Whitelabeling / SaaS: Customers get a branded experience by passing a custom theme object to
    ThemeProvider
    — no forking required.
  • Accessibility Compliance: Build WCAG 2.1 AA compliance into the library once, and every product inherits it automatically.

✨ Features

  • 40+ accessible, composable React components
  • Built on Radix UI primitives
  • Design tokens for color, spacing, and typography
  • Full dark mode via CSS custom properties
  • Tree-shakeable — only import what you use
  • TypeScript-first with full type exports
  • WCAG 2.1 AA compliant

📦 Installation

npm install @yourorg/design-system

# Peer dependencies
npm install react react-dom

🚀 Quick Start

import { ThemeProvider, Button, Card } from "@yourorg/design-system";
import "@yourorg/design-system/styles.css";

function App() {
  return (
    <ThemeProvider theme="light">
      <Card>
        <Button variant="primary" size="md">
          Get Started
        </Button>
      </Card>
    </ThemeProvider>
  );
}

💡 Usage

Importing components

import { Button, Input, Modal, Toast } from "@yourorg/design-system";

Button variants

<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="destructive" size="sm">Delete</Button>

Form example

import { Input, Label, Button } from "@yourorg/design-system";

function LoginForm() {
  return (
    <form>
      <Label htmlFor="email">Email</Label>
      <Input id="email" type="email" placeholder="you@example.com" />
      <Button type="submit" variant="primary">Sign In</Button>
    </form>
  );
}

Opening a Modal

import { Modal, Button } from "@yourorg/design-system";

function Example() {
  const [open, setOpen] = useState(false);
  return (
    <>
      <Button onClick={() => setOpen(true)}>Open Modal</Button>
      <Modal open={open} onClose={() => setOpen(false)} title="Confirm Action">
        Are you sure you want to continue?
      </Modal>
    </>
  );
}

📖 See all components in Storybook


🎨 Design Tokens

:root {
  --color-primary-500: #3b82f6;
  --color-neutral-900: #111827;
  --spacing-4: 1rem;
  --spacing-8: 2rem;
  --font-size-base: 1rem;
  --radius-md: 0.5rem;
}

🧩 Components

ComponentDescriptionStatus
ButtonClickable actions✅ Stable
InputText input with validation✅ Stable
SelectDropdown selection✅ Stable
ModalOverlay dialogs✅ Stable
ToastNotification messages✅ Stable
DataTableSortable, filterable tables🚧 Beta
DatePickerCalendar date selection🚧 Beta
CommandMenu⌘K command palette📋 Planned

🎨 Theming

// Built-in themes
<ThemeProvider theme="dark">...</ThemeProvider>

// Custom brand colors
<ThemeProvider theme={{ colors: { primary: { 500: "#7c3aed" } } }}>
  ...
</ThemeProvider>

📖 Storybook

npm run storybook          # Run locally
npm run storybook:build    # Build static Storybook

Live: https://storybook.yourorg.com


📂 Project Structure

design-system/
├── tokens/
├── src/
│   ├── components/
│   │   ├── Button/
│   │   │   ├── Button.tsx
│   │   │   ├── Button.stories.tsx
│   │   │   └── Button.test.tsx
│   │   └── ...
│   ├── hooks/
│   └── index.ts
├── .storybook/
└── package.json

🤝 Contributing

New components require:

  • TypeScript types and JSDoc comments
  • Storybook stories (default, all variants, edge cases)
  • Unit tests (≥ 80% coverage)
  • ARIA roles and keyboard navigation
  • Export added to
    src/index.ts
npm run dev
npm run test
npm run a11y

🔢 Versioning

This project follows Semantic Versioning. See CHANGELOG.md.

npm run release    # Maintainers only

📝 License

Distributed under the MIT License. See LICENSE for more information.

README Templates FAQ

Common questions about using our GitHub README templates.