A professional, scalable design system built with React 18, TypeScript, Radix UI, and Storybook
A production-ready, scalable design system built with modern best practices.
---
```
design-system/
āāā src/
ā āāā tokens/ # Design tokens (Type-safe)
ā ā āāā colors.ts # Brand & semantic colors (50-950 scales)
ā ā āāā spacing.ts # 8px grid system (0-96)
ā ā āāā typography.ts # Font families, sizes, weights
ā ā āāā radii.ts # Border radius values
ā ā āāā shadows.ts # Elevation shadows
ā ā āāā index.ts # Token exports
ā ā
ā āāā theme/ # Theme system
ā ā āāā theme.ts # Theme configuration
ā ā āāā ThemeProvider.tsx # React context provider
ā ā āāā index.ts
ā ā
ā āāā components/ # Component library
ā ā āāā Button/
ā ā ā āāā Button.tsx # Component logic
ā ā ā āāā Button.scss # SCSS styles
ā ā ā āāā Button.stories.tsx # Storybook stories
ā ā ā āāā index.ts
ā ā ā
ā ā āāā Input/ # Text input with labels, icons, errors
ā ā āāā Switch/ # Toggle switch
ā ā āāā Checkbox/ # Checkbox with labels
ā ā āāā Select/ # Dropdown select
ā ā āāā index.ts # Component exports
ā ā
ā āāā index.ts # Main entry point
ā
āāā dist/ # Build output
ā āāā index.js # CommonJS bundle
ā āāā index.mjs # ESM bundle
ā āāā index.d.ts # TypeScript declarations
ā āāā design-system.css # Compiled CSS from SCSS
ā āāā [component folders]/ # Individual declarations
ā
āāā stories/ # Storybook files
āāā .storybook/ # Storybook config
āāā tsconfig.json # TypeScript config
āāā vite.config.ts # Vite build config
āāā package.json # Package manifest
āāā README.md # Usage documentation
---
with CSS variables for customization$3
- Variants: surface, classic, soft
- Sizes: 1-3
- Colors: Custom focus colors (primary, secondary, accent, etc.)
- Features: Labels, helper text, error states, left/right icons, full width
- SCSS File: Input.scss with focus states and variants$3
- Sizes: 1-3
- Colors: Custom colors beyond Radix defaults
- Features: Labels, helper text, left/right label positions
- SCSS File: Switch.scss$3
- Sizes: 1-3
- Colors: Custom colors
- Features: Labels, helper text, error states, indeterminate state
- SCSS File: Checkbox.scss$3
- Variants: surface, classic, soft, ghost
- Sizes: 1-3
- Colors: Custom focus colors
- Features: Labels, helper text, error states, disabled options, full width
- SCSS File: Select.scss---
šÆ Design Tokens System
$3
`typescript
import { colors } from 'design-system';// Brand colors with 50-950 scales
colors.brand.primary[500] // #0ea5e9
colors.brand.secondary[600] // #475569
colors.brand.accent[500] // #d946ef
// Semantic colors
colors.semantic.success.main // #059669
colors.semantic.error.main // #dc2626
colors.semantic.warning.main // #d97706
colors.semantic.info.main // #2563eb
`$3
`typescript
import { spacing } from 'design-system';spacing[4] // 1rem (16px)
spacing[8] // 2rem (32px)
spacing[16] // 4rem (64px)
`$3
`typescript
import { typography } from 'design-system';typography.fontFamily.sans
typography.fontSize.base // 1rem (16px)
typography.fontWeight.bold // 700
`---
š How to Use in Your Primary Project
$3
`bash
Install from npm
npm install @dynamic-mockups/design-system @radix-ui/themes react react-domOr with yarn
yarn add @dynamic-mockups/design-system @radix-ui/themes react react-dom
`$3
1. Import CSS Files (REQUIRED)
`tsx
// In your main App.tsx, main.tsx, or index.tsx
import '@radix-ui/themes/styles.css';
import '@dynamic-mockups/design-system/styles.css'; // ā IMPORTANT: Import design system CSS
`2. Wrap with ThemeProvider
`tsx
import { ThemeProvider } from '@dynamic-mockups/design-system';function App() {
return (
appearance="light"
accentColor="blue"
radius="medium"
>
);
}
`3. Use Components
`tsx
import { Button, Input, Select, Switch, Checkbox } from '@dynamic-mockups/design-system';function MyPage() {
return (
);
}
`---
šØ SCSS Customization
$3
Create a
custom-theme.scss in your project:`scss
:root {
// Brand colors
--color-primary: #0ea5e9;
--color-primary-hover: #0284c7;
--color-primary-soft: #e0f2fe;
--color-secondary: #64748b;
--color-accent: #d946ef;
// Semantic colors
--color-success: #10b981;
--color-error: #ef4444;
--color-warning: #f59e0b;
--color-info: #3b82f6;
}
`$3
`scss
@use 'design-system' as ds;.my-component {
// Use tokens directly in your SCSS
color: var(--color-primary);
padding: var(--spacing-4);
border-radius: var(--radii-lg);
&:hover {
background-color: var(--color-primary-soft);
}
}
`$3
If you want to customize component styles:
`scss
// Import and override
@use 'design-system/components/Button/Button.scss' with (
$button-primary-bg: #your-color
);
`---
š Available Scripts
`bash
Development
yarn storybook # Run Storybook on port 6006
yarn dev # Run Vite dev serverBuilding
yarn build # Build the library (TS + Vite)
yarn build-storybook # Build Storybook for deploymentQuality
yarn typecheck # Run TypeScript type checking
`---
š¦ Build Output
$3
`json
{
"main": "dist/index.js", // CommonJS
"module": "dist/index.mjs", // ESM
"types": "dist/index.d.ts", // TypeScript
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./styles.css": "./dist/design-system.css"
}
}
`$3
- ESM: ~186 KB (50 KB gzipped)
- CJS: ~127 KB (41 KB gzipped)
- CSS: ~11 KB (1.8 KB gzipped)---
šÆ Key Features
ā
Type-Safe - Full TypeScript support with exported types
ā
Tree-Shakeable - Import only what you need
ā
Customizable - SCSS variables and CSS custom properties
ā
Accessible - Built on Radix UI primitives (WCAG compliant)
ā
Token-Based - Consistent design with design tokens
ā
Documented - Comprehensive Storybook documentation
ā
Production Ready - Tested, built, and ready to publish
---
š Next Steps
1. Run Storybook to see all components:
`bash
yarn storybook
`2. Customize colors in
src/tokens/colors.ts3. Add more components following the same pattern:
- Create component folder
- Add TypeScript component
- Add SCSS styles
- Create Storybook stories
- Export from
src/components/index.ts4. Test in your primary project using
npm link`---
The system is scalable, maintainable, and follows industry best practices used by companies like Shopify, Atlassian, and GitHub.
---
Developed by https://dynamicmockups.com