Package Exports
- react-vite-themes
Readme
React Vite Themes
A comprehensive React theme system with Vite, featuring atomic design components, SCSS variables, and dark/light theme support.
Features
- 🎨 Atomic Design System - Organized components from atoms to organisms
- 🌙 Dark/Light Themes - Seamless theme switching with context
- 🎯 TypeScript Support - Full type safety and IntelliSense
- 📱 Responsive Design - Mobile-first approach with breakpoints
- 🎨 SCSS Variables - Consistent design tokens and theming
- ⚡ Vite Optimized - Fast development and builds
- 📚 Storybook Integration - Component documentation and testing
Installation
npm install @react-vite-themes/core
Quick Start
1. Import the Theme Provider
import { ThemeProvider } from '@react-vite-themes/core';
function App() {
return (
<ThemeProvider>
<YourApp />
</ThemeProvider>
);
}
2. Import the CSS
import '@react-vite-themes/core/styles';
3. Use Components
import { Button, Card, Input } from '@react-vite-themes/core';
function MyComponent() {
return (
<Card variant="elevated">
<Input placeholder="Enter your name" />
<Button variant="primary">Submit</Button>
</Card>
);
}
Available Components
Atoms
Alert
- Notification messagesButton
- Interactive buttons with variantsCard
- Content containersForm
- Form wrappersIcon
- Icon componentsInput
- Form inputs and textareasModal
- Overlay dialogsNavbar
- Navigation barsSearchBar
- Search inputsSidebar
- Side navigation
Utilities
ThemeToggle
- Theme switching componentuseTheme
- Theme context hookuseLocalStorage
- Local storage hookclassNames
- CSS class utility
Theme System
Using the Theme Hook
import { useTheme } from '@react-vite-themes/core';
function MyComponent() {
const { theme, toggleTheme } = useTheme();
return (
<div>
<p>Current theme: {theme}</p>
<button onClick={toggleTheme}>Toggle Theme</button>
</div>
);
}
Custom Themes
The theme system uses CSS custom properties that you can override:
:root {
--color-primary-500: #3b82f6;
--color-background: #ffffff;
--color-text-primary: #1f2937;
}
[data-theme='dark'] {
--color-background: #1f2937;
--color-text-primary: #f9fafb;
}
Component Variants
Button Variants
default
- Standard buttonprimary
- Primary actionsecondary
- Secondary actionoutline
- Bordered styleghost
- Minimal style
Card Variants
elevated
- With shadowoutline
- Borderedfilled
- Background filledglass
- Glassmorphismbordered
- Primary border
Form Variants
default
- Standard formelevated
- With shadowglass
- Glassmorphismbordered
- Bordered style
Development
Local Development
# Install dependencies
npm install
# Start development server
npm run dev
# Start Storybook
npm run storybook
# Build for production
npm run build
Building the Package
# Build all assets
npm run build
# Build types only
npm run build:types
# Build styles only
npm run build:styles
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
- 📖 Documentation
- 🐛 Issues
- 💬 Discussions