A React starter template that integrates Figma tokens, MUI design, and Tailwind CSS with support for multiple themes, Storybook integration, and theme switching.
Clone the repository:
git clone https://github.com/anupsahu/figma-design-system.git
cd figma-design-system
Install dependencies:
npm install
Start the development server:
npm run dev
Open your browser and navigate to http://localhost:5173
npm run dev
- Start the development servernpm run build
- Build the project for productionnpm run preview
- Preview the production buildnpm run storybook
- Start Storybook for component developmentnpm run build-storybook
- Build Storybook for deploymentnpm run tokens:build
- Build design tokensnpm run tokens:import
- Import tokens from Figmanpm run tokens:sync
- Build and sync tokensThis project uses Style Dictionary to manage design tokens. The tokens are stored in the tokens/src
directory and are organized by category:
colors.json
- Color tokenstypography.json
- Typography tokensspacing.json
- Spacing tokensthemes.json
- Theme-specific tokensTo sync tokens from Figma:
tokens/src
directorynpm run tokens:import
to convert Figma tokensnpm run tokens:build
to generate the CSS variables and TypeScript filesThe project includes a built-in theme switching mechanism. You can use the ThemeProvider
component to wrap your application and the useTheme
hook to access and change the current theme:
import { useTheme } from './theme/ThemeProvider';
function MyComponent() {
const { themeMode, toggleTheme } = useTheme();
return (
<div>
<p>Current theme: {themeMode}</p>
<button onClick={toggleTheme}>Toggle Theme</button>
</div>
);
}
This project includes Storybook for component development and documentation. To start Storybook:
npm run storybook
Storybook includes a theme switcher in the toolbar that allows you to preview components in different themes.
figma-design-system/
โโโ .storybook/ # Storybook configuration
โโโ public/ # Public assets
โโโ src/
โ โโโ assets/ # Static assets
โ โโโ components/ # UI components
โ โโโ styles/ # Global styles
โ โโโ theme/ # Theme configuration
โ โโโ App.tsx # Main application component
โ โโโ main.tsx # Application entry point
โโโ tokens/
โ โโโ src/ # Source token files
โ โโโ build/ # Built token files
โ โโโ build.mjs # Token build script
โ โโโ figma-to-tokens.mjs # Figma token converter
โโโ index.html # HTML entry point
โโโ package.json # Project dependencies and scripts
โโโ tailwind.config.js # Tailwind CSS configuration
โโโ vite.config.ts # Vite configuration
This project is licensed under the MIT License - see the LICENSE file for details.