Observed since 20 Oct, 18:58 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A modern React UI component library
A modern React UI component library designed for building beautiful, accessible, and responsive web applications.
# npm
npm install 21st-kit
# yarn
yarn add 21st-kit
# pnpm
pnpm add 21st-kit
import React from 'react';
import { ThemeProvider, Button, Card, CardContent } from '21st-kit';
import '21st-kit/dist/index.css';
function App() {
return (
<ThemeProvider>
<Card>
<CardContent>
<h2>Hello, 21st-Kit!</h2>
<p>A modern React UI component library</p>
<Button>Get Started</Button>
</CardContent>
</Card>
</ThemeProvider>
);
}
export default App;
21st-Kit comes with a powerful theming system that allows you to customize the look and feel of your application.
import { ThemeProvider } from '21st-kit';
function App() {
const customTheme = {
colors: {
primary: '#0070f3',
secondary: '#7928ca',
// Override other colors as needed
},
borderRadius: {
md: '0.5rem',
// Override other border radiuses as needed
},
// Override other theme values as needed
};
return (
<ThemeProvider theme={customTheme}>
{/* Your app content */}
</ThemeProvider>
);
}
21st-Kit works seamlessly with popular form libraries like React Hook Form and Formik.
import { useForm, Controller } from 'react-hook-form';
import { Form, FormItem, FormLabel, FormControl, FormMessage, Input, Button } from '21st-kit';
function LoginForm() {
const { control, handleSubmit, formState: { errors } } = useForm({
defaultValues: {
email: '',
password: '',
}
});
const onSubmit = (data) => {
console.log(data);
};
return (
<Form onSubmit={handleSubmit(onSubmit)}>
<FormItem validationState={errors.email ? 'invalid' : 'default'}>
<FormLabel required>Email</FormLabel>
<FormControl>
<Controller
name="email"
control={control}
rules={{
required: 'Email is required',
pattern: {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
message: 'Invalid email address'
}
}}
render={({ field }) => (
<Input
type="email"
placeholder="Enter your email"
{...field}
/>
)}
/>
</FormControl>
<FormMessage error={errors.email?.message} />
</FormItem>
{/* Password field and submit button */}
</Form>
);
}
Many components in 21st-Kit support both controlled and uncontrolled usage patterns.
import { useState } from 'react';
import { Tabs, TabsList, TabsTrigger, TabsContent } from '21st-kit';
function ControlledTabs() {
const [activeTab, setActiveTab] = useState('tab1');
return (
<Tabs value={activeTab} onValueChange={setActiveTab}>
<TabsList>
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
</TabsList>
<TabsContent value="tab1">Content for Tab 1</TabsContent>
<TabsContent value="tab2">Content for Tab 2</TabsContent>
</Tabs>
);
}
import { Tabs, TabsList, TabsTrigger, TabsContent } from '21st-kit';
function UncontrolledTabs() {
return (
<Tabs defaultValue="tab1">
<TabsList>
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
</TabsList>
<TabsContent value="tab1">Content for Tab 1</TabsContent>
<TabsContent value="tab2">Content for Tab 2</TabsContent>
</Tabs>
);
}
21st-Kit provides multiple button variants to suit different UI needs:
import { Button } from '21st-kit';
function ButtonExamples() {
return (
<div>
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="text">Text</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>
<Button variant="danger">Danger</Button>
<Button variant="success">Success</Button>
<Button variant="warning">Warning</Button>
<Button variant="info">Info</Button>
{/* Icon buttons */}
<Button size="icon" aria-label="Settings">
<SettingsIcon />
</Button>
{/* Loading state */}
<Button loading>Loading</Button>
{/* With icons */}
<Button leftIcon={<DownloadIcon />}>Download</Button>
<Button rightIcon={<ArrowRightIcon />}>Next</Button>
</div>
);
}
We welcome contributions! Please see our Contributing Guide for more details.
MIT © Bharadwaj Apittu
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 18:58 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:725ef12fd97144e37867c27a11bd0bacdab631c797479e5639ff012296fb4229