@chakra-ui/react
Chakra UI is an accessible, modular React component library that provides a set of composable building blocks for creating user interfaces with speed. Chakra's …
Installation
npm install @chakra-ui/react @emotion/react @emotion/styled
yarn add @chakra-ui/react @emotion/react @emotion/styled
pnpm add @chakra-ui/react @emotion/react @emotion/styled
Import
import { ChakraProvider, Button } from '@chakra-ui/react';Quick Example
import { Box, Button, Heading, Text, Stack } from '@chakra-ui/react';
function Card() {
return (
<Box bg="white" p={6} rounded="xl" shadow="md">
<Heading size="md" mb={2}>Hello</Heading>
<Text color="gray.600" mb={4}>Welcome to Chakra UI</Text>
<Stack direction="row" spacing={3}>
<Button colorScheme="blue">Primary</Button>
<Button variant="outline">Secondary</Button>
</Stack>
</Box>
);
}About @chakra-ui/react
Chakra UI is an accessible, modular React component library that provides a set of composable building blocks for creating user interfaces with speed. Chakra's key differentiator is its style props system — components accept CSS properties directly as props (bg='blue.500', p={4}, fontSize='lg'), powered by a comprehensive theme token system that ensures design consistency. The theme system maps semantic tokens to values: colors use a numeric scale (blue.100 through blue.900), spacing uses a consistent scale, and responsive values are expressed as arrays [base, md, lg] or objects {{ base: 'sm', md: 'lg' }}. Chakra UI includes essential components like Box, Flex, Grid, Stack, Button, Input, Modal, Drawer, Toast, Menu, Tabs, Accordion, and form controls, all with built-in accessibility features including focus management, keyboard navigation, and ARIA attributes. The library supports dark mode through useColorMode with automatic class-based or system preference detection. Component variants are defined in the theme, enabling consistent styling across instances. Chakra's factory function (chakra.div) creates styled components that accept all style props. The library has been widely adopted for its excellent developer experience, particularly by teams that prefer a prop-based styling approach over CSS class names.
Quick Facts
| Package | @chakra-ui/react |
| Category | UI Component |
| Weekly Downloads | 1M+ |
| License | MIT |
| Install | npm install @chakra-ui/react @emotion/react @emotion/styled |
Related Packages
Material UI (MUI) is the most popular React UI component library, implementing Google's Material Des…
Mantine is a fully featured React component library providing 100+ customizable components, 50+ hook…
Emotion is a performant and flexible CSS-in-JS library that provides multiple APIs for styling React…
React is the most popular JavaScript library for building user interfaces, developed and maintained …
Radix UI is a collection of unstyled, accessible React component primitives for building high-qualit…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.