Catalog npm
Back to packageRELEASE DETAILS

0.1.3

npm

21st-kit

A modern React UI component library

componentsdesign-systemreacttypescriptui
Published25 Feb 2025
Direct dependencies37
Transitive dependenciesNot calculated

README

Current package documentation

21st-Kit

A modern React UI component library designed for building beautiful, accessible, and responsive web applications.

npm version License: MIT

Features

  • 🎨 Modern Design: Clean, minimal, and customizable components
  • 🧩 Composable: Components designed to work together seamlessly
  • 📱 Responsive: Mobile-first design approach
  • ♿ Accessible: Built with accessibility in mind (WCAG 2.1 compliant)
  • 🌗 Themeable: Easily customize colors, spacing, and more
  • 🔍 TypeScript: Full TypeScript support with comprehensive type definitions
  • 🧪 Well-tested: Thoroughly tested components
  • 📦 Tree-shakable: Only import what you need
  • 🔄 Controlled & Uncontrolled: Support for both controlled and uncontrolled components

Installation

# npm
npm install 21st-kit

# yarn
yarn add 21st-kit

# pnpm
pnpm add 21st-kit

Quick Start

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;

Components

Basic Components

  • Button: Various styles, sizes, and states
  • Card: Flexible container with header, content, and footer
  • Avatar: User avatars with image fallback
  • Badge: Small status indicators
  • Alert: Contextual feedback messages
  • Progress: Progress indicators
  • Tooltip: Informative text when hovering over elements

Form Components

  • Input: Text input fields
  • Textarea: Multi-line text input
  • Select: Dropdown selection
  • Checkbox: Single checkbox
  • Radio: Radio button groups
  • Switch: Toggle switches
  • Form: Complete form system with validation states

Navigation Components

  • Tabs: Tabbed interfaces with controlled and uncontrolled versions

Theme Customization

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>
  );
}

Form Integration

21st-Kit works seamlessly with popular form libraries like React Hook Form and Formik.

React Hook Form Example

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>
  );
}

Controlled vs Uncontrolled Components

Many components in 21st-Kit support both controlled and uncontrolled usage patterns.

Controlled Tabs Example

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>
  );
}

Uncontrolled Tabs Example

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>
  );
}

Button Variants

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>
  );
}

Contributing

We welcome contributions! Please see our Contributing Guide for more details.

License

MIT © Bharadwaj Apittu

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 39

Native requirements
37 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
clsx
Environment
{
  "local_name": "clsx",
  "alias": false,
  "peer_metadata": null
}
^2.1.1runtime
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0runtime
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.0.0runtime
class-variance-authority
Environment
{
  "local_name": "class-variance-authority",
  "alias": false,
  "peer_metadata": null
}
^0.7.0runtime
sass
Environment
{
  "local_name": "sass",
  "alias": false,
  "peer_metadata": null
}
^1.85.1development
vite
Environment
{
  "local_name": "vite",
  "alias": false,
  "peer_metadata": null
}
^4.4.5development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^8.45.0development
postcss
Environment
{
  "local_name": "postcss",
  "alias": false,
  "peer_metadata": null
}
^8.4.31development
storybook
Environment
{
  "local_name": "storybook",
  "alias": false,
  "peer_metadata": null
}
^7.5.3development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.0.2development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^20.9.0development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.2.15development
autoprefixer
Environment
{
  "local_name": "autoprefixer",
  "alias": false,
  "peer_metadata": null
}
^10.4.16development
@storybook/test
Environment
{
  "local_name": "@storybook/test",
  "alias": false,
  "peer_metadata": null
}
^7.6.20development
vite-plugin-dts
Environment
{
  "local_name": "vite-plugin-dts",
  "alias": false,
  "peer_metadata": null
}
^3.6.3development
@storybook/react
Environment
{
  "local_name": "@storybook/react",
  "alias": false,
  "peer_metadata": null
}
^7.6.20development
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.2.7development
@storybook/blocks
Environment
{
  "local_name": "@storybook/blocks",
  "alias": false,
  "peer_metadata": null
}
^7.5.3development
@rollup/plugin-json
Environment
{
  "local_name": "@rollup/plugin-json",
  "alias": false,
  "peer_metadata": null
}
^6.1.0development
@vitejs/plugin-react
Environment
{
  "local_name": "@vitejs/plugin-react",
  "alias": false,
  "peer_metadata": null
}
^4.0.3development
rollup-plugin-terser
Environment
{
  "local_name": "rollup-plugin-terser",
  "alias": false,
  "peer_metadata": null
}
^7.0.2development
@storybook/react-vite
Environment
{
  "local_name": "@storybook/react-vite",
  "alias": false,
  "peer_metadata": null
}
^7.5.3development
rollup-plugin-postcss
Environment
{
  "local_name": "rollup-plugin-postcss",
  "alias": false,
  "peer_metadata": null
}
^4.0.2development
@storybook/addon-links
Environment
{
  "local_name": "@storybook/addon-links",
  "alias": false,
  "peer_metadata": null
}
^7.5.3development
@rollup/plugin-commonjs
Environment
{
  "local_name": "@rollup/plugin-commonjs",
  "alias": false,
  "peer_metadata": null
}
^28.0.2development
eslint-plugin-storybook
Environment
{
  "local_name": "eslint-plugin-storybook",
  "alias": false,
  "peer_metadata": null
}
^0.6.15development
@rollup/plugin-typescript
Environment
{
  "local_name": "@rollup/plugin-typescript",
  "alias": false,
  "peer_metadata": null
}
^12.1.2development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
^6.0.0development
eslint-plugin-react-hooks
Environment
{
  "local_name": "eslint-plugin-react-hooks",
  "alias": false,
  "peer_metadata": null
}
^4.6.0development
@storybook/testing-library
Environment
{
  "local_name": "@storybook/testing-library",
  "alias": false,
  "peer_metadata": null
}
^0.2.2development
@rollup/plugin-node-resolve
Environment
{
  "local_name": "@rollup/plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
^16.0.0development
@storybook/addon-essentials
Environment
{
  "local_name": "@storybook/addon-essentials",
  "alias": false,
  "peer_metadata": null
}
^7.6.20development
@storybook/addon-onboarding
Environment
{
  "local_name": "@storybook/addon-onboarding",
  "alias": false,
  "peer_metadata": null
}
^1.0.11development
eslint-plugin-react-refresh
Environment
{
  "local_name": "eslint-plugin-react-refresh",
  "alias": false,
  "peer_metadata": null
}
^0.4.3development
@storybook/addon-interactions
Environment
{
  "local_name": "@storybook/addon-interactions",
  "alias": false,
  "peer_metadata": null
}
^7.5.3development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^6.0.0development
rollup-plugin-peer-deps-external
Environment
{
  "local_name": "rollup-plugin-peer-deps-external",
  "alias": false,
  "peer_metadata": null
}
^2.2.4development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0peer
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "09ccb276b2a9234e0e3629d8d70af6fafd17ba1a",
  "tarball": "https://registry.npmjs.org/21st-kit/-/21st-kit-0.1.3.tgz",
  "fileCount": 29,
  "integrity": "sha512-WyppgNXqa0IX8cCFNJWOxIVOF3AJ8x3jzFTBiCF+SBpZNwGxLbDndpTwGsEaZOdYwfXicjL1KUh75DeIGCsftQ==",
  "signatures": [
    {
      "sig": "MEQCIC8Unf/03QUXMdo6A3cPWWOxOSWWbXJYO0/zvFP+lZlEAiAnu8jCHlvhQargGmSPghB8eEfga0bI7oLBPwp2wPeVqA==",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 89582
}

Repository

PENDING
yourusername/atomix-ui

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:58 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:33e4cd7e49c98c0620746308a658a9d16fd8a59fbc6b6fb50d78039b96324704

Other collected versions

0.1.425 FebView all collected versions →