# Cerberus Design System Cerberus is a comprehensive design system factory developed by Omnifederal that provides a complete suite of tools for building accessible, themeable React applications. It consists of four main packages: `@cerberus/panda-preset` for PandaCSS styling presets and recipes, `@cerberus-design/react` for React primitive components built on Ark UI, `@cerberus-design/signals` for fine-grained reactive state management, and `@cerberus-design/data-grid` for high-performance virtualized data tables. The design system emphasizes WCAG accessibility compliance, with all components meeting Level AAA standards for target size and interaction patterns. Cerberus supports multiple themes (Cerberus, Acheron, Elysium) with light and dark color modes, and integrates seamlessly with PandaCSS for type-safe styling through semantic design tokens and slot recipes. ## Installation and Setup ### Installing the Panda Preset ```bash # Using JSR (recommended for non-React packages) npx jsr add @cerberus/panda-preset # Install themes separately npx jsr add @cerberus/preset-cerberus-theme npx jsr add @cerberus/preset-acheron-theme npx jsr add @cerberus/preset-elysium-theme ``` ### Installing React Components ```bash # Using npm for React packages npm install @cerberus-design/react ``` ### Installing Signals Library ```bash npx jsr add @cerberus/signals ``` ### Installing Data Grid ```bash npm install @cerberus-design/data-grid ``` --- ## Panda Preset Configuration ### createCerberusConfig A function to define a PandaCSS configuration with Cerberus settings, including preflight styles, JSX framework configuration, and output directory settings. ```typescript // panda.config.ts import { createCerberusConfig, createCerberusPreset } from '@cerberus/panda-preset' export default createCerberusConfig({ clean: true, include: ['./src/**/*.{js,jsx,ts,tsx}'], exclude: [], presets: [createCerberusPreset({ displayFont: 'Poppins, sans-serif', sansFont: 'Poppins, sans-serif', monoFont: 'Recursive, monospace', })], }) ``` ### Multi-Theme Configuration Configure multiple themes in your Panda config to support theme switching throughout your application. ```typescript // panda.config.ts import { createCerberusConfig, createCerberusPreset } from '@cerberus/panda-preset' import { presetAcheronTheme, getThemeName as getAcheronThemeName } from '@cerberus/preset-acheron-theme' import { presetElysiumTheme, getThemeName as getElysiumThemeName } from '@cerberus/preset-elysium-theme' export default createCerberusConfig({ clean: true, include: ['./src/**/*.{js,jsx,ts,tsx}'], exclude: [], presets: [createCerberusPreset(), presetAcheronTheme, presetElysiumTheme], staticCss: { themes: ['cerberus', getAcheronThemeName(), getElysiumThemeName()], }, }) ``` --- ## React Components ### CerberusProvider The root provider component that supplies configuration context to all Cerberus components, including custom icons and system settings. ```tsx import { CerberusProvider, makeSystemConfig } from '@cerberus-design/react' // Optional: Create custom config with custom icons const config = makeSystemConfig({ icons: { // Override default icons } }) function App() { return ( ) } ``` ### ThemeProvider A context provider for managing theme and color mode state, supporting theme switching between Cerberus, Acheron, and Elysium themes with light/dark modes. ```tsx import { ThemeProvider, useThemeContext } from '@cerberus-design/react' function App() { return ( ) } function ThemeToggle() { const { theme, mode, updateTheme, updateMode } = useThemeContext() return (

Current theme: {theme}, mode: {mode}

) } ``` ### Button A WCAG Level AAA compliant button component with support for multiple palettes, usages, shapes, sizes, and loading states. ```tsx import { Button, ButtonIcon } from '@cerberus-design/react' import { Add } from '@carbon/icons-react' function ButtonExamples() { const [pending, setPending] = useState(false) return ( <> {/* Basic button */} {/* Button variants */} {/* Button with icon and loading state */} {/* Button shapes */} ) } ``` ### Field and Input Form field components with built-in label, helper text, and error handling for accessible form inputs. ```tsx import { Field, Input } from '@cerberus-design/react' function ContactForm() { const [invalid, setInvalid] = useState(false) return (
setInvalid(!e.target.value)} />
) } ``` ### Select A dropdown select component with collection-based items, supporting disabled options and custom placeholders. ```tsx import { Select, Option, createListCollection } from '@cerberus-design/react' function SelectExample() { const collection = createListCollection({ items: [ { label: 'Hades', value: 'hades' }, { label: 'Persephone', value: 'persephone' }, { label: 'Zeus', value: 'zeus', disabled: true }, { label: 'Athena', value: 'athena' }, ] }) return ( ) } ``` ### Checkbox A controlled checkbox component with indeterminate state support and accessible labeling. ```tsx import { Checkbox } from '@cerberus-design/react' function CheckboxExample() { const [checked, setChecked] = useState(false) const [items, setItems] = useState([false, false, false]) const allChecked = items.every(Boolean) const indeterminate = items.some(Boolean) && !allChecked return ( <> {/* Simple checkbox */} setChecked(details.checked)} > Accept terms and conditions {/* Parent checkbox with indeterminate state */} setItems(items.map(() => !!details.checked))} > Select All {/* Required checkbox */} I confirm this information is accurate ) } ``` ### Dialog A modal dialog component with backdrop, positioning, and close triggers for displaying focused content. ```tsx import { Dialog, DialogProvider, DialogTrigger, DialogCloseTrigger, DialogHeading, DialogDescription, } from '@cerberus-design/react' import { Button } from '@cerberus-design/react' function DialogExample() { return ( Confirm Action Are you sure you want to proceed with this action? This cannot be undone. ) } ``` ### ConfirmModal A pre-built confirmation modal provider with promise-based API for handling user consent flows. ```tsx import { ConfirmModal, useConfirmModal, Button } from '@cerberus-design/react' function FeatureSection() { return ( ) } function DeleteButton() { const confirm = useConfirmModal() const handleDelete = async () => { const userConsent = await confirm.show({ kind: 'destructive', heading: 'Delete this item?', description: 'This action cannot be undone. All associated data will be permanently removed.', actionText: 'Yes, delete item', cancelText: 'No, keep it', }) if (userConsent) { // User confirmed - proceed with deletion await deleteItem() } } return } ``` ### Menu A dropdown menu component for displaying a list of actions or options. ```tsx import { Menu, MenuTrigger, MenuContent, MenuItem, MenuItemGroup, MenuGroupLabel, MenuSeparator, } from '@cerberus-design/react' import { Button } from '@cerberus-design/react' function MenuExample() { return ( File Operations console.log('New file')}> New File Open File Save console.log('Delete')}> Delete ) } ``` ### Tabs A tabbed interface component for organizing content into separate panels. ```tsx import { Tabs } from '@cerberus-design/react' function TabsExample() { return ( Overview Analytics Settings

Overview Content

This is the overview panel content.

Analytics Content

View your analytics data here.

Settings Content

Configure your preferences.

) } ``` ### Accordion An expandable/collapsible content component for organizing information in a compact format. ```tsx import { AccordionRoot, AccordionItem, AccordionItemTrigger, AccordionItemContent, AccordionItemIndicator, } from '@cerberus-design/react' import { ChevronDown } from '@carbon/icons-react' function AccordionExample() { return ( What is Cerberus? Cerberus is a comprehensive design system providing React components, PandaCSS presets, and state management tools. How do I install it? Install via npm for React packages or JSR for other packages. ) } ``` ### Tooltip A component for displaying additional information on hover. ```tsx import { Tooltip, Button } from '@cerberus-design/react' import { Information } from '@carbon/icons-react' function TooltipExample() { return ( <> {/* Basic tooltip */} {/* Icon with tooltip */} {/* Positioned tooltip */} ) } ``` ### NotificationCenter A toast notification system for displaying transient messages to users. ```tsx import { NotificationCenter, toaster, Button } from '@cerberus-design/react' function App() { return ( <> ) } function NotifyButton() { const showNotifications = () => { // Success notification toaster.create({ title: 'Success!', description: 'Your changes have been saved.', type: 'success', }) // Error notification toaster.create({ title: 'Error', description: 'Failed to save changes. Please try again.', type: 'danger', }) // Info notification with action toaster.create({ title: 'New Update Available', description: 'A new version is ready to install.', type: 'info', action: { label: 'Update Now', onClick: () => console.log('Updating...'), }, }) } return } ``` ### FileUploader A drag-and-drop file upload component with preview support. ```tsx import { FileUploader } from '@cerberus-design/react' function FileUploadExample() { return ( { console.log('Accepted files:', details.files) }} onFileReject={(details) => { console.log('Rejected files:', details.files) }} /> ) } ``` ### DatePicker A date selection component with calendar view and range support. ```tsx import { DatePicker, DatePickerInput, DatePickerCalendar } from '@cerberus-design/react' function DatePickerExample() { return ( console.log('Selected date:', details.value)} > ) } ``` ### Show and For Components Utility components for conditional rendering and list iteration. ```tsx import { Show, For } from '@cerberus-design/react' function ConditionalRendering() { const [isLoggedIn, setIsLoggedIn] = useState(false) const items = ['Apple', 'Banana', 'Cherry'] return ( <> {/* Conditional rendering with fallback */} }> {/* List rendering */}
    {(item, index) => (
  • {item}
  • )}
) } ``` --- ## Signals Library ### createSignal Creates a reactive signal with getter and setter functions for fine-grained state management outside of React's reconciliation. ```typescript import { createSignal, createEffect } from '@cerberus-design/signals' // Create a global signal (outside React components) const [getCount, setCount] = createSignal(0) const [getUser, setUser] = createSignal({ name: 'John', age: 30 }) // Read the signal value console.log(getCount()) // 0 // Update the signal setCount(5) setCount((prev) => prev + 1) // Supports functional updates // Create reactive effects const cleanup = createEffect(() => { console.log('Count changed to:', getCount()) }) // Clean up when done cleanup() ``` ### createComputed Creates a derived/computed value that automatically tracks dependencies and recomputes only when source signals change. ```typescript import { createSignal, createComputed } from '@cerberus-design/signals' const [getFirstName, setFirstName] = createSignal('John') const [getLastName, setLastName] = createSignal('Doe') // Computed value automatically tracks dependencies const getFullName = createComputed(() => { return `${getFirstName()} ${getLastName()}` }) console.log(getFullName()) // "John Doe" setFirstName('Jane') console.log(getFullName()) // "Jane Doe" - automatically recomputed ``` ### createEffect Creates a reactive side effect that automatically tracks signal dependencies and re-runs when they change. ```typescript import { createSignal, createEffect } from '@cerberus-design/signals' const [getTheme, setTheme] = createSignal('light') // Effect runs immediately and whenever getTheme changes const cleanup = createEffect(() => { document.body.classList.toggle('dark', getTheme() === 'dark') // Optional cleanup function return () => { document.body.classList.remove('dark', 'light') } }) setTheme('dark') // Effect re-runs, body gets 'dark' class // Manual cleanup when component unmounts cleanup() ``` ### useSignal A React hook for creating signals within components, combining createSignal with React's lifecycle. ```tsx import { useSignal, ReactiveText } from '@cerberus-design/signals' function Counter() { const [count, setCount, getCount] = useSignal(0) return (
{/* Regular React rendering - full component re-render */}

Count: {count}

{/* Fine-grained reactivity - only text updates */}

Reactive Count:

) } ``` ### useRead A hook for reading global signals within React components, bridging signals with React's rendering. ```tsx import { createSignal } from '@cerberus-design/signals' import { useRead } from '@cerberus-design/signals' // Global signal defined outside component const [getUser, setUser] = createSignal({ name: 'Guest', isAuthenticated: false }) function UserProfile() { // Subscribe to global signal changes const user = useRead(getUser) return (

Welcome, {user.name}!

{user.isAuthenticated && }
) } // Update from anywhere function login(userData) { setUser({ ...userData, isAuthenticated: true }) } ``` ### createQuery Creates a reactive query for data fetching with automatic caching and signal-based argument tracking. ```tsx import { createSignal, createQuery } from '@cerberus-design/signals' import { useQuery } from '@cerberus-design/signals' import { Suspense } from 'react' // Signal for query arguments const [getUserId, setUserId] = createSignal(1) // Create the query - automatically refetches when userId changes const userQuery = createQuery( getUserId, async (userId) => { const response = await fetch(`/api/users/${userId}`) return response.json() } ) function UserDetails() { // useQuery integrates with Suspense and Error Boundaries const user = useQuery(userQuery) return (

{user.name}

{user.email}

) } function App() { return ( }> ) } // Change user - query automatically refetches function switchUser(id: number) { setUserId(id) } ``` ### createMutation Creates a mutation handler with automatic cache invalidation for modifying server data. ```tsx import { createSignal, createQuery, createMutation } from '@cerberus-design/signals' import { useMutation } from '@cerberus-design/signals' // Query to invalidate const [getUserId, setUserId] = createSignal(1) const userQuery = createQuery(getUserId, fetchUser) // Create mutation with invalidation const updateUserMutation = createMutation( async (userData: { id: number; name: string }) => { const response = await fetch(`/api/users/${userData.id}`, { method: 'PUT', body: JSON.stringify(userData), }) return response.json() }, { onSuccess: (data) => console.log('User updated:', data), onError: (error) => console.error('Update failed:', error), // Invalidate the user query after successful mutation invalidate: (data, variables) => [userQuery.key], } ) function EditUserForm() { const { mutate, status, error } = useMutation(updateUserMutation) const handleSubmit = async (formData: FormData) => { await mutate({ id: 1, name: formData.get('name') as string, }) } return (
{status === 'error' &&

Error: {String(error)}

}
) } ``` --- ## Data Grid ### DataGrid Component A high-performance, virtualized data grid with sorting, filtering, pagination, and column pinning. ```tsx import { DataGrid, createColumnHelper } from '@cerberus-design/data-grid' interface User { id: number firstName: string lastName: string email: string role: string status: 'active' | 'inactive' } const columnHelper = createColumnHelper() const columns = [ columnHelper.accessor('id', { header: 'ID', width: 80, features: { sort: true, pinning: { defaultPosition: 'left' }, }, }), columnHelper.accessorFn( (row) => `${row.firstName} ${row.lastName}`, { id: 'fullName', header: 'Full Name', width: 200, features: { sort: true, filter: true }, } ), columnHelper.accessor('email', { header: 'Email', width: 250, features: { filter: { operator: 'contains' } }, }), columnHelper.accessor('status', { header: 'Status', width: 120, cell: ({ value }) => ( {value} ), }), columnHelper.display({ id: 'actions', header: 'Actions', width: 150, cell: ({ row }) => ( ), }), ] function UsersTable() { const [users, setUsers] = useState([]) return ( { console.log('Page changed:', details.page) }} toolbar={} theme={{ borderColor: 'page.border.initial', rowHoverBgColor: 'page.surface.200', }} /> ) } ``` ### createColumnHelper A type-safe helper for defining data grid columns with accessor, accessorFn, and display column types. ```tsx import { createColumnHelper, type ColumnDef } from '@cerberus-design/data-grid' interface Product { id: string name: string price: number category: string inStock: boolean } const columnHelper = createColumnHelper() const columns: ColumnDef[] = [ // Simple accessor - accesses property directly columnHelper.accessor('name', { header: 'Product Name', width: 200, features: { sort: true, filter: true, }, }), // AccessorFn - compute derived values columnHelper.accessorFn( (row) => `$${row.price.toFixed(2)}`, { id: 'formattedPrice', header: 'Price', width: 100, features: { sort: { comparator: (a, b) => parseFloat(a.slice(1)) - parseFloat(b.slice(1)), }, }, } ), // Display column - no accessor, custom render only columnHelper.display({ id: 'availability', header: 'Availability', width: 120, cell: ({ row }) => ( {row.inStock ? 'In Stock' : 'Out of Stock'} ), }), ] ``` ### useDataGridContext A hook for accessing the data grid store within custom toolbar or cell components. ```tsx import { useDataGridContext } from '@cerberus-design/data-grid' import { useRead } from '@cerberus-design/signals' function GridToolbar() { const store = useDataGridContext() const globalFilter = useRead(store.globalFilter) const rowCount = useRead(store.rowCount) return ( store.setGlobalFilter(e.target.value)} placeholder="Search all columns..." /> Total rows: {rowCount} ) } function UsersGrid() { return ( } /> ) } ``` --- ## Summary Cerberus Design System provides a complete toolkit for building modern, accessible React applications. The modular architecture allows teams to adopt individual packages based on their needs: use `@cerberus/panda-preset` for consistent styling with PandaCSS recipes and semantic tokens, `@cerberus-design/react` for pre-built accessible UI components, `@cerberus-design/signals` for fine-grained reactivity that bypasses React's reconciliation overhead, and `@cerberus-design/data-grid` for performant virtualized tables with built-in sorting, filtering, and pagination. The system integrates seamlessly with Next.js and other React frameworks through its JSR/npm distribution. Common integration patterns include wrapping your application with `CerberusProvider` and `ThemeProvider` at the root, using the signals library for complex state management scenarios where React's re-rendering model becomes a bottleneck, and leveraging the DataGrid for large dataset visualization. All components follow WCAG accessibility guidelines and support multiple themes with light/dark color modes out of the box.