A modern, DaisyUI-inspired React component library built as a Tailwind CSS plugin
npm install paradox-uiA modern, DaisyUI-inspired React component library built as a Tailwind CSS plugin. Paradox UI provides semantic, high-level component class names that are abstractions of Tailwind's low-level utility classes, improving developer speed, code readability, and maintainability while retaining the full customization power of Tailwind.
- ๐จ DaisyUI-Inspired: Semantic component class names like btn, card
- ๐งฉ Compound Components: Flexible component composition patterns
- ๐ฏ TypeScript First: Full TypeScript support with strict typing
- ๐ Theme System: Dynamic theming with CSS custom properties
- โฟ Accessible: Built with accessibility best practices
- ๐ฑ Responsive: Mobile-first design approach
- ๐ญ Storybook: Comprehensive component documentation
- ๐งช Tested: Full test coverage with Jest and React Testing Library
- ๐ฆ Tree-Shakable: Optimized bundle size with selective imports
- ๐ง Developer Friendly: Excellent DX with hot reload and IntelliSense
``bash`
npm install paradox-uior
yarn add paradox-uior
pnpm add paradox-ui
Paradox UI requires the following peer dependencies:
`bash`
npm install react react-dom tailwindcssor
yarn add react react-dom tailwindcssor
pnpm add react react-dom tailwindcss
Make sure you have Tailwind CSS configured in your project. If you don't, create a tailwind.config.js:
`javascript`
module.exports = {
content: [
'./src/*/.{js,ts,jsx,tsx}',
'./node_modules/paradox-ui/dist/*/.{js,ts,jsx,tsx}',
],
theme: {
extend: {},
},
plugins: [],
};
Import the Paradox UI styles in your main CSS file:
`css`
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
Wrap your application with the ThemeProvider:
`tsx
import React from 'react';
import { ThemeProvider } from 'paradox-ui';
function App() {
return (
{/ Your app content /}
);
}
`
`tsx
import { Button } from 'paradox-ui';
function Example() {
return (
variant="success"
icon={
iconPosition="right"
>
Add New
$3
`tsx
import { Card, CardTitle, CardBody, CardActions, CardMedia } from 'paradox-ui';function Example() {
return (
Card Title
This is the card body content. You can put any content here.
);
}
// Card with image
function CardWithImage() {
return (
Beautiful Image
Cards can have images at the top, bottom, left, or right.
);
}
`$3
Paradox UI works great with icon libraries like Heroicons, Lucide React, or custom SVG icons:
`tsx
import { Button } from 'paradox-ui';
import { PlusIcon, TrashIcon } from '@heroicons/react/24/outline';function IconExample() {
return (
}>
Add Item
variant="error"
icon={ }
iconPosition="right"
>
Delete
);
}
`๐จ Theming
$3
Paradox UI comes with built-in light and dark themes:
`tsx
import { ThemeProvider, useTheme } from 'paradox-ui';function App() {
return (
defaultTheme="light"
persistTheme={true} // Save theme preference to localStorage
>
{/ Your app content /}
);
}
function ThemeToggle() {
const { theme, setTheme, toggleDarkMode } = useTheme();
return (
Current theme: {theme.displayName}
);
}
`$3
Create your own themes by extending the base theme:
`tsx
import { ThemeProvider, createThemeVariant } from 'paradox-ui';
import { lightTheme } from 'paradox-ui/themes';const corporateTheme = createThemeVariant(
lightTheme,
'corporate',
'Corporate',
(theme) => ({
colors: {
...theme.colors,
primary: {
...theme.colors.primary,
500: '#1e40af', // Custom primary color
},
},
})
);
function App() {
return (
defaultTheme="corporate"
themes={[lightTheme, corporateTheme]}
>
{/ Your app content /}
);
}
`๐ง Component API Reference
$3
`tsx
interface ButtonProps extends React.ButtonHTMLAttributes {
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'link' | 'info' | 'success' | 'warning' | 'error';
size?: 'sm' | 'md' | 'lg';
loading?: boolean;
disabledWhileLoading?: boolean;
fullWidth?: boolean;
shape?: 'default' | 'square' | 'circle';
icon?: React.ReactNode;
iconPosition?: 'left' | 'right';
loadingIndicator?: React.ReactNode;
as?: React.ElementType;
}
`$3
`tsx
interface CardProps extends React.HTMLAttributes {
variant?: 'default' | 'bordered' | 'compact' | 'side';
shadow?: boolean;
responsive?: boolean;
backgroundColor?: 'base-100' | 'base-200' | 'neutral';
imageSrc?: string;
imageAlt?: string;
imagePosition?: 'top' | 'bottom' | 'left' | 'right';
}
`#### Card Sub-components
-
CardTitle: Card title with configurable heading level
- CardBody: Main content area
- CardActions: Action buttons area
- CardMedia: Image or custom media content
- CardFooter: Footer section๐ฆ Bundle Size
Paradox UI is optimized for minimal bundle impact:
- Full Library: ~45KB gzipped
- Individual Components: ~8-15KB gzipped each
- Tree-shakable: Only import what you use
$3
You can import individual components to reduce bundle size further:
`tsx
// Import all components (larger bundle)
import { Button, Card } from 'paradox-ui';// Import individual components (smaller bundle)
import Button from 'paradox-ui/Button';
import Card from 'paradox-ui/Card';
`๐งช Development
$3
`bash
Clone the repository
git clone https://github.com/yourusername/paradox-ui.git
cd paradox-uiInstall dependencies
npm installStart development server
npm run devStart Storybook
npm run storybookRun tests
npm testRun tests with coverage
npm run test:coverageBuild library
npm run build
`$3
`
paradox-ui/
โโโ src/
โ โโโ components/ # React components
โ โ โโโ Button/
โ โ โโโ Card/
โ โโโ providers/ # React context providers
โ โโโ types/ # TypeScript type definitions
โ โโโ utils/ # Utility functions
โ โโโ hooks/ # Custom React hooks
โ โโโ styles/ # CSS and styling
โ โโโ index.ts # Main entry point
โโโ .storybook/ # Storybook configuration
โโโ stories/ # Storybook stories
โโโ dist/ # Built library
โโโ package.json
`$3
1. Create component directory in
src/components/
2. Implement component with TypeScript
3. Create Storybook stories
4. Write comprehensive tests
5. Update exports in src/index.tsExample:
`tsx
// src/components/Alert/Alert.tsx
import React from 'react';
import { cn } from '../../utils/cn';interface AlertProps extends React.HTMLAttributes {
variant?: 'info' | 'success' | 'warning' | 'error';
children: React.ReactNode;
}
export const Alert = ({ variant = 'info', className, children, ...props }: AlertProps) => {
const variantClasses = {
info: 'alert-info',
success: 'alert-success',
warning: 'alert-warning',
error: 'alert-error',
};
return (
className={cn('alert', variantClasses[variant], className)}
role="alert"
{...props}
>
{children}
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
- TypeScript: All components must have full TypeScript support
- Accessibility: Components must be accessible (ARIA attributes, keyboard navigation)
- Testing: New components require comprehensive tests
- Documentation: Update Storybook stories and API documentation
- Code Style: Follow existing patterns and use ESLint configuration
MIT License - see the LICENSE file for details.
- DaisyUI for the inspiration and design philosophy
- Tailwind CSS for the amazing utility-first CSS framework
- Storybook for the component documentation platform
- The React community for excellent patterns and practices
- Documentation
- Storybook
- NPM Package
- GitHub Repository
- Report Issues
---
Built with โค๏ธ for the React community