A modern, production-ready React component library featuring InputField and DataTable components built with TypeScript, TailwindCSS, and industry best practices.
- ** Multiple Variants**: Outlined, Filled, Ghost styles
- ** Flexible Sizing**: Small, Medium, Large configurations
- ** Advanced States**: Loading, Error, Disabled with smooth animations
- ** Enhanced UX**: Floating labels, clear button, password toggle
- ** Full Validation**: Error messages, helper text, required fields
- ** Accessibility**: ARIA labels, keyboard navigation, screen reader support
- ** Dark Mode**: Complete dark theme integration
- ** Interactive Sorting**: Click headers to sort ascending/descending
- ** Row Selection**: Single, multiple, or no selection modes
- ** Modern UI**: Hover effects, striped rows, clean borders
- ** Responsive Design**: Horizontal scroll, mobile-optimized
- ** Loading States**: Skeleton loading and empty state handling
- ** Custom Rendering**: Support for custom cell renderers and actions
- ** Pagination**: Built-in pagination with page size controls
- ** Sticky Headers**: Keep headers visible during scrolling
- ** Dark Mode**: Seamless dark theme support
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2+ | Modern React with hooks and functional components |
| TypeScript | 5.8+ | Type safety and enhanced developer experience |
| TailwindCSS | 3.4+ | Utility-first styling framework |
| Storybook | 7+ | Component documentation and testing |
| Vite | 5.4+ | Fast build tool and development server |
| Heroicons | 2.2+ | Beautiful SVG icons |
| Lucide React | 0.539+ | Additional icon library |
# Clone the repository
git clone https://github.com/yourusername/react-components-library.git
cd react-components-library
# Install dependencies
npm install
# Start development server
npm run dev
# Launch Storybook (Component Documentation)
npm run storybook# Development
npm run dev # Start Vite dev server
npm run storybook # Launch Storybook
# Production
npm run build # Build for production
npm run build-storybook # Build Storybook
# Code Quality
npm run lint # Run ESLint
npm run preview # Preview production build
# Run Chromatic for Storybook
npm run chromatic #Deploy Storybook
๐ This will give you a public Storybook link like:
๐ https://68a2dfe4cb8afbff5930bb67-zswgcohqbu.chromatic.com
import { InputField } from "./components/InputField";
import { useState } from "react";
function LoginForm() {
const [formData, setFormData] = useState({
email: "",
password: "",
});
return (
<form className="space-y-4">
<InputField
label="Email Address"
placeholder="Enter your email"
type="email"
value={formData.email}
onChange={(e) =>
setFormData((prev) => ({
...prev,
email: e.target.value,
}))
}
variant="outlined"
size="md"
clearable
required
helperText="We'll never share your email"
/>
<InputField
label="Password"
placeholder="Enter your password"
type="password"
value={formData.password}
onChange={(e) =>
setFormData((prev) => ({
...prev,
password: e.target.value,
}))
}
variant="outlined"
size="md"
togglePassword
required
helperText="Must be at least 8 characters"
/>
</form>
);
}import { DataTable } from "./components/DataTable";
import { useState } from "react";
interface User {
id: number;
name: string;
email: string;
role: string;
status: "Active" | "Inactive";
}
function UserManagement() {
const [selectedUsers, setSelectedUsers] = useState<User[]>([]);
const users: User[] = [
{
id: 1,
name: "John Doe",
email: "john@example.com",
role: "Developer",
status: "Active",
},
// ... more users
];
const columns = [
{
key: "id",
title: "ID",
dataIndex: "id" as keyof User,
sortable: true,
width: 80,
},
{
key: "name",
title: "Full Name",
dataIndex: "name" as keyof User,
sortable: true,
render: (value: string) => (
<div className="flex items-center gap-3">
<div className="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center text-white text-sm font-semibold">
{value
.split(" ")
.map((n) => n[0])
.join("")}
</div>
<span className="font-medium">{value}</span>
</div>
),
},
{
key: "status",
title: "Status",
dataIndex: "status" as keyof User,
render: (value: string) => (
<span
className={`px-3 py-1 rounded-full text-xs font-medium ${
value === "Active"
? "bg-green-100 text-green-800"
: "bg-gray-100 text-gray-800"
}`}
>
{value}
</span>
),
},
];
return (
<DataTable
data={users}
columns={columns}
selectable="multiple"
onRowSelect={setSelectedUsers}
hoverable
striped
pagination={{
current: 1,
pageSize: 10,
total: users.length,
onChange: (page, pageSize) => {
console.log("Page changed:", page, pageSize);
},
}}
onRowClick={(user) => {
console.log("User clicked:", user.name);
}}
/>
);
}| Property | Type | Default | Description |
|---|---|---|---|
value |
string |
'' |
Input value |
onChange |
(e: ChangeEvent) => void |
- | Change event handler |
label |
string |
- | Floating label text |
placeholder |
string |
- | Placeholder text |
variant |
'outlined' | 'filled' | 'ghost' |
'outlined' |
Visual style variant |
size |
'sm' | 'md' | 'lg' |
'md' |
Component size |
type |
string |
'text' |
HTML input type |
disabled |
boolean |
false |
Disable the input |
invalid |
boolean |
false |
Show error state |
loading |
boolean |
false |
Show loading spinner |
clearable |
boolean |
false |
Show clear button |
togglePassword |
boolean |
false |
Show password visibility toggle |
required |
boolean |
false |
Mark field as required |
helperText |
string |
- | Helper text below input |
errorMessage |
string |
- | Error message text |
| Property | Type | Default | Description |
|---|---|---|---|
data |
T[] |
- | Array of data objects |
columns |
Column<T>[] |
- | Column definitions |
loading |
boolean |
false |
Show loading state |
selectable |
boolean | 'single' | 'multiple' |
false |
Row selection mode |
onRowSelect |
(rows: T[]) => void |
- | Selection change callback |
size |
'sm' | 'md' | 'lg' |
'md' |
Table size |
striped |
boolean |
true |
Alternate row colors |
hoverable |
boolean |
true |
Row hover effects |
bordered |
boolean |
true |
Show table borders |
sticky |
boolean |
false |
Sticky table header |
maxHeight |
string | number |
- | Maximum table height |
pagination |
PaginationConfig |
- | Pagination configuration |
onRowClick |
(record: T, index: number) => void |
- | Row click handler |
emptyText |
ReactNode |
- | Custom empty state content |
- Primary: Blue (#3B82F6 - #2563EB)
- Success: Green (#10B981 - #059669)
- Warning: Amber (#F59E0B - #D97706)
- Error: Red (#EF4444 - #DC2626)
- Neutral: Gray (#F9FAFB - #111827)
- Headings: 600-700 font weight
- Body: 400-500 font weight
- Small: 0.875rem (14px)
- Base: 1rem (16px)
- Large: 1.125rem (18px)
- xs: 0.5rem (8px)
- sm: 0.75rem (12px)
- md: 1rem (16px)
- lg: 1.5rem (24px)
- xl: 2rem (32px)
Both components feature complete dark mode support. Toggle dark mode programmatically:
// Toggle dark mode
const toggleDarkMode = () => {
document.documentElement.classList.toggle("dark");
};
// Or set explicitly
document.documentElement.classList.add("dark"); // Enable
document.documentElement.classList.remove("dark"); // Disable- Mobile First: Optimized for mobile devices
- Breakpoints: sm (640px), md (768px), lg (1024px), xl (1280px)
- Touch Friendly: Proper touch targets (44px minimum)
- Adaptive: Components adjust to container width
- โ Semantic HTML: Proper HTML5 elements and structure
- โ ARIA Labels: Full screen reader support
- โ Keyboard Navigation: Tab, Enter, Space key support
- โ Focus Management: Clear focus indicators and trapping
- โ Color Contrast: WCAG AA compliant (4.5:1 ratio)
- โ Screen Reader: Tested with NVDA and VoiceOver
Access comprehensive component documentation and interactive playground:
npm run storybookVisit http://localhost:6006 to explore:
- Interactive component playground
- All variants, states, and configurations
- Usage examples and code snippets
- Props documentation with controls
- Dark mode toggle for testing
- Responsive viewport testing
Deployment Options:
- Vercel: Connect GitHub repository for auto-deployment
- Netlify: Drag & drop
storybook-staticfolder - GitHub Pages: Use GitHub Actions workflow
- Chromatic:
npx chromatic --project-token=<your-token>
react-components-library/
โโโ ๐ .storybook/ # Storybook configuration
โ โโโ main.ts
โ โโโ preview.tsx
โโโ ๐ src/
โ โโโ ๐ components/
โ โ โโโ ๐ InputField/
โ โ โ โโโ InputField.tsx
โ โ โ โโโ InputField.types.ts
โ โ โ โโโ InputField.stories.tsx
โ โ โ โโโ index.ts
โ โ โโโ ๐ DataTable/
โ โ โโโ DataTable.tsx
โ โ โโโ DataTable.types.ts
โ โ โโโ DataTable.stories.tsx
โ โ โโโ index.ts
โ โโโ App.tsx
โ โโโ main.tsx
โ โโโ index.css
โโโ ๐ package.json
โโโ ๐ tsconfig.json
โโโ ๐ tailwind.config.js
โโโ ๐ vite.config.ts
โโโ ๐ README.md
- Unit Tests: Component logic testing
- Integration Tests: Component interaction testing
- Visual Tests: Storybook visual regression testing
- Accessibility Tests: A11y compliance validation
- DatePicker component
- Select/Dropdown component
- Textarea component
- File upload component
- Virtual scrolling for large datasets
- Advanced filtering and search
- Drag & drop functionality
- Export functionality (CSV, PDF)
- Theme customization system
- Component generator CLI
- Figma design tokens integration
- Performance optimization
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Submit a Pull Request
git clone https://github.com/yourusername/react-components-library.git
cd react-components-library
npm install
npm run devThis project is licensed under the MIT License - see the LICENSE file for details.
- ๐ง Email: your.email@example.com
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
react_components/ โ โโโ node_modules/ โ โโโ src/ โ โโโ components/ โ โ โโโ InputField/ โ โ โ โโโ InputField.tsx โ โ โ โโโ InputField.types.ts โ โ โ โโโ InputField.stories.tsx โ โ โ โโโ index.ts โ โ โ โ โ โโโ DataTable/ โ โ โ โโโ DataTable.tsx โ โ โ โโโ DataTable.types.ts โ โ โ โโโ DataTable.stories.tsx โ โ โ โโโ index.ts โ โ | | โ โโโ App.tsx โ โโโ main.tsx โ โโโ index.css โ โโโ vite-env.d.ts โ โโโ .storybook/ โ โโโ main.ts โ โโโ preview.ts โ โโโ .gitignore โโโ eslint.config.js โโโ index.html โโโ package.json โโโ tsconfig.json โโโ tsconfig.app.json โโโ tsconfig.node.json โโโ vite.config.ts โโโ README.md
- Add more input types (date, select, textarea)
- DataTable virtual scrolling for large datasets
- Form validation integration
- Animation presets
- Theme customization system
- Additional component variants
Happy coding!

