HeroUI v3
An open-source UI component library for React (web) and React Native (mobile). Built on Tailwind CSS v4 and React Aria Components. Provides 75+ accessible, customizable web components and 40+ native components.
Technology Stack
| Platform |
Package |
Requires |
| React (Web) |
@heroui/react, @heroui/styles |
React 19+, Tailwind CSS v4 |
| React Native |
heroui-native |
React Native, Uniwind, react-native-reanimated 4.1+, react-native-gesture-handler 2.28+ |
Quick Setup
React (Web)
npm i @heroui/react @heroui/styles
/* globals.css — order matters */
@import "tailwindcss";
@import "@heroui/styles";
import { Button } from "@heroui/react";
function App() {
return <Button>Click me</Button>;
}
React Native
npm install heroui-native react-native-reanimated@^4.1.1 react-native-gesture-handler@^2.28.0 react-native-worklets@^0.5.1 react-native-safe-area-context@^5.6.0 react-native-svg@^15.12.1 tailwind-variants@^3.2.2 tailwind-merge@^3.4.0
/* global.css */
@import "tailwindcss";
@import "uniwind";
@import "heroui-native/styles";
@source "./node_modules/heroui-native/lib";
import { HeroUINativeProvider } from "heroui-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { Button } from "heroui-native";
export default function App() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<HeroUINativeProvider>
<Button => console.log("Pressed!")}>Get Started</Button>
</HeroUINativeProvider>
</GestureHandlerRootView>
);
}
For detailed setup instructions, see react-setup.md and native-setup.md.
Component Architecture
HeroUI v3 uses compound component composition with dot notation:
<Modal>
<Button>Open</Button>
<Modal.Backdrop>
<Modal.Container>
<Modal.Dialog>
<Modal.Header>
<Modal.Heading>Title</Modal.Heading>
</Modal.Header>
<Modal.Body>Content</Modal.Body>
<Modal.Footer>
<Button slot="close">Close</Button>
</Modal.Footer>
</Modal.Dialog>
</Modal.Container>
</Modal.Backdrop>
</Modal>
Three Import Patterns
// 1. Compound (recommended)
<Alert>
<Alert.Icon />
<Alert.Content>
<Alert.Title>Success</Alert.Title>
</Alert.Content>
</Alert>
// 2. With .Root suffix
<Alert.Root>
<Alert.Icon />
</Alert.Root>
// 3. Named exports
import { AlertRoot, AlertIcon, AlertContent, AlertTitle } from "@heroui/react";
Type Imports
import type { ButtonRootProps, AvatarRootProps } from "@heroui/react";
React Web Components (75+)
| Category |
Components |
| Buttons |
Button, ButtonGroup, CloseButton, ToggleButton, ToggleButtonGroup |
| Collections |
Dropdown, ListBox, TagGroup |
| Colors |
ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker |
| Controls |
Slider, Switch |
| Data Display |
Badge, Chip, Table |
| Date & Time |
Calendar, DateField, DatePicker, DateRangePicker, RangeCalendar, TimeField |
| Feedback |
Alert, Meter, ProgressBar, ProgressCircle, Skeleton, Spinner, Toast |
| Forms |
Checkbox, CheckboxGroup, Description, ErrorMessage, FieldError, Fieldset, Form, Input, InputGroup, InputOTP, Label, NumberField, RadioGroup, SearchField, TextField, TextArea |
| Layout |
Card, Separator, Surface, Toolbar |
| Media |
Avatar |
| Navigation |
Accordion, Breadcrumbs, Disclosure, DisclosureGroup, Link, Pagination, Tabs |
| Overlays |
AlertDialog, Drawer, Modal, Popover, Tooltip |
| Pickers |
Autocomplete, ComboBox, Select |
| Typography |
Kbd |
| Utilities |
ScrollShadow |
For component anatomy, props, and usage patterns, see react-components.md.
React Native Components (40+)
| Category |
Components |
| Buttons |
Button, CloseButton, LinkButton |
| Collections |
Menu, TagGroup |
| Controls |
Slider, Switch, Checkbox |
| Data Display |
Chip, Avatar |
| Feedback |
Alert, Spinner, Skeleton, SkeletonGroup, Toast |
| Forms |
ControlField, Description, FieldError, Input, InputGroup, InputOTP, Label, RadioGroup, SearchField, Select, TextArea, TextField |
| Layout |
Card, Separator, Surface, Accordion, ListGroup, Tabs |
| Overlays |
BottomSheet, Dialog, Popover |
| Utilities |
PressableFeedback, ScrollShadow |
For native component details, see native-components.md.
Styling System
HeroUI v3 provides three styling approaches:
1. BEM Classes
<button className="button button--primary button--lg">Click</button>
Class pattern: .{block}, .{block}__{element}, .{block}--{modifier}
2. Variant Functions (Type-Safe)
import { buttonVariants } from "@heroui/styles";
<a className={buttonVariants({ variant: "primary", size: "lg" })} href="/about">
About
</a>
Variant functions are framework-agnostic — usable with Vue, Svelte, vanilla HTML.
3. Tailwind CSS Classes + className Prop
<Button className="rounded-full shadow-lg">Styled</Button>
Custom Variants
import { buttonVariants, tv } from "@heroui/styles";
const myButton = tv({
extend: buttonVariants,
base: "font-semibold shadow-md",
variants: {
radius: { lg: "rounded-lg", md: "rounded-md" },
},
});
render Prop for Custom Elements
<Button
render={(domProps, { isPressed }) => (
<motion.button {...domProps} animate={{ scale: isPressed ? 0.9 : 1 }} />
)}
>
Animated
</Button>
For theming, CSS variables, dark mode, custom themes, and component-level overrides, see theming-and-styling.md.
Common Prop Patterns
Interactive States (Data Attributes)
| State |
Attribute |
CSS Pseudo |
| Hover |
[data-hovered="true"] |
:hover |
| Pressed |
[data-pressed="true"] |
:active |
| Focus |
[data-focus-visible="true"] |
:focus-visible |
| Disabled |
[aria-disabled="true"] |
:disabled |
| Selected |
[data-selected="true"] |
— |
| Open |
[data-open="true"] |
— |
| Entering |
[data-entering] |
— |
| Exiting |
[data-exiting] |
— |
Event Handlers
HeroUI uses React Aria's press events, not native click events:
<Button => console.log("pressed")} />
Overlay State Management
import { useOverlayState } from "@heroui/react";
const state = useOverlayState({ defaultOpen: false });
// state.isOpen, state.open(), state.close(), state.toggle(), state.setOpen()
Form Validation
import { Form, TextField, Button } from "@heroui/react";
<Form validationBehavior="aria"
<TextField name="email" isRequired>
<Label>Email</Label>
<Input />
<FieldError />
</TextField>
<Button type="submit">Submit</Button>
</Form>
Two validation modes: "native" (blocks submission) and "aria" (realtime errors).
Documentation Resources
1---2name: heroui3description: HeroUI v3 component library expertise for React (web) and React Native (mobile). Use when code imports @heroui/react, @heroui/styles, or heroui-native, user asks to build UI with HeroUI, or references HeroUI components, theming, or migration from NextUI/HeroUI v2.4---56# HeroUI v378An open-source UI component library for React (web) and React Native (mobile). Built on Tailwind CSS v4 and React Aria Components. Provides 75+ accessible, customizable web components and 40+ native components.910## Technology Stack1112| Platform | Package | Requires |13|----------|---------|----------|14| React (Web) | `@heroui/react`, `@heroui/styles` | React 19+, Tailwind CSS v4 |15| React Native | `heroui-native` | React Native, Uniwind, react-native-reanimated 4.1+, react-native-gesture-handler 2.28+ |1617## Quick Setup1819### React (Web)2021```bash22npm i @heroui/react @heroui/styles23```2425```css26/* globals.css — order matters */27@import "tailwindcss";28@import "@heroui/styles";29```3031```tsx32import { Button } from "@heroui/react";3334function App() {35 return <Button>Click me</Button>;36}37```3839### React Native4041```bash42npm install heroui-native react-native-reanimated@^4.1.1 react-native-gesture-handler@^2.28.0 react-native-worklets@^0.5.1 react-native-safe-area-context@^5.6.0 react-native-svg@^15.12.1 tailwind-variants@^3.2.2 tailwind-merge@^3.4.043```4445```css46/* global.css */47@import "tailwindcss";48@import "uniwind";49@import "heroui-native/styles";50@source "./node_modules/heroui-native/lib";51```5253```tsx54import { HeroUINativeProvider } from "heroui-native";55import { GestureHandlerRootView } from "react-native-gesture-handler";56import { Button } from "heroui-native";5758export default function App() {59 return (60 <GestureHandlerRootView style={{ flex: 1 }}>61 <HeroUINativeProvider>62 <Button onPress={() => console.log("Pressed!")}>Get Started</Button>63 </HeroUINativeProvider>64 </GestureHandlerRootView>65 );66}67```6869For detailed setup instructions, see [react-setup.md](references/react-setup.md) and [native-setup.md](references/native-setup.md).7071## Component Architecture7273HeroUI v3 uses **compound component composition** with dot notation:7475```tsx76<Modal>77 <Button>Open</Button>78 <Modal.Backdrop>79 <Modal.Container>80 <Modal.Dialog>81 <Modal.Header>82 <Modal.Heading>Title</Modal.Heading>83 </Modal.Header>84 <Modal.Body>Content</Modal.Body>85 <Modal.Footer>86 <Button slot="close">Close</Button>87 </Modal.Footer>88 </Modal.Dialog>89 </Modal.Container>90 </Modal.Backdrop>91</Modal>92```9394### Three Import Patterns9596```tsx97// 1. Compound (recommended)98<Alert>99 <Alert.Icon />100 <Alert.Content>101 <Alert.Title>Success</Alert.Title>102 </Alert.Content>103</Alert>104105// 2. With .Root suffix106<Alert.Root>107 <Alert.Icon />108</Alert.Root>109110// 3. Named exports111import { AlertRoot, AlertIcon, AlertContent, AlertTitle } from "@heroui/react";112```113114### Type Imports115116```tsx117import type { ButtonRootProps, AvatarRootProps } from "@heroui/react";118```119120## React Web Components (75+)121122| Category | Components |123|----------|------------|124| Buttons | Button, ButtonGroup, CloseButton, ToggleButton, ToggleButtonGroup |125| Collections | Dropdown, ListBox, TagGroup |126| Colors | ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker |127| Controls | Slider, Switch |128| Data Display | Badge, Chip, Table |129| Date & Time | Calendar, DateField, DatePicker, DateRangePicker, RangeCalendar, TimeField |130| Feedback | Alert, Meter, ProgressBar, ProgressCircle, Skeleton, Spinner, Toast |131| Forms | Checkbox, CheckboxGroup, Description, ErrorMessage, FieldError, Fieldset, Form, Input, InputGroup, InputOTP, Label, NumberField, RadioGroup, SearchField, TextField, TextArea |132| Layout | Card, Separator, Surface, Toolbar |133| Media | Avatar |134| Navigation | Accordion, Breadcrumbs, Disclosure, DisclosureGroup, Link, Pagination, Tabs |135| Overlays | AlertDialog, Drawer, Modal, Popover, Tooltip |136| Pickers | Autocomplete, ComboBox, Select |137| Typography | Kbd |138| Utilities | ScrollShadow |139140For component anatomy, props, and usage patterns, see [react-components.md](references/react-components.md).141142## React Native Components (40+)143144| Category | Components |145|----------|------------|146| Buttons | Button, CloseButton, LinkButton |147| Collections | Menu, TagGroup |148| Controls | Slider, Switch, Checkbox |149| Data Display | Chip, Avatar |150| Feedback | Alert, Spinner, Skeleton, SkeletonGroup, Toast |151| Forms | ControlField, Description, FieldError, Input, InputGroup, InputOTP, Label, RadioGroup, SearchField, Select, TextArea, TextField |152| Layout | Card, Separator, Surface, Accordion, ListGroup, Tabs |153| Overlays | BottomSheet, Dialog, Popover |154| Utilities | PressableFeedback, ScrollShadow |155156For native component details, see [native-components.md](references/native-components.md).157158## Styling System159160HeroUI v3 provides three styling approaches:161162### 1. BEM Classes163164```tsx165<button className="button button--primary button--lg">Click</button>166```167168Class pattern: `.{block}`, `.{block}__{element}`, `.{block}--{modifier}`169170### 2. Variant Functions (Type-Safe)171172```tsx173import { buttonVariants } from "@heroui/styles";174175<a className={buttonVariants({ variant: "primary", size: "lg" })} href="/about">176 About177</a>178```179180Variant functions are framework-agnostic — usable with Vue, Svelte, vanilla HTML.181182### 3. Tailwind CSS Classes + className Prop183184```tsx185<Button className="rounded-full shadow-lg">Styled</Button>186```187188### Custom Variants189190```tsx191import { buttonVariants, tv } from "@heroui/styles";192193const myButton = tv({194 extend: buttonVariants,195 base: "font-semibold shadow-md",196 variants: {197 radius: { lg: "rounded-lg", md: "rounded-md" },198 },199});200```201202### render Prop for Custom Elements203204```tsx205<Button206 render={(domProps, { isPressed }) => (207 <motion.button {...domProps} animate={{ scale: isPressed ? 0.9 : 1 }} />208 )}209>210 Animated211</Button>212```213214For theming, CSS variables, dark mode, custom themes, and component-level overrides, see [theming-and-styling.md](references/theming-and-styling.md).215216## Common Prop Patterns217218### Interactive States (Data Attributes)219220| State | Attribute | CSS Pseudo |221|-------|-----------|------------|222| Hover | `[data-hovered="true"]` | `:hover` |223| Pressed | `[data-pressed="true"]` | `:active` |224| Focus | `[data-focus-visible="true"]` | `:focus-visible` |225| Disabled | `[aria-disabled="true"]` | `:disabled` |226| Selected | `[data-selected="true"]` | — |227| Open | `[data-open="true"]` | — |228| Entering | `[data-entering]` | — |229| Exiting | `[data-exiting]` | — |230231### Event Handlers232233HeroUI uses React Aria's press events, not native click events:234235```tsx236<Button onPress={(e) => console.log("pressed")} />237```238239### Overlay State Management240241```tsx242import { useOverlayState } from "@heroui/react";243244const state = useOverlayState({ defaultOpen: false });245// state.isOpen, state.open(), state.close(), state.toggle(), state.setOpen()246```247248## Form Validation249250```tsx251import { Form, TextField, Button } from "@heroui/react";252253<Form validationBehavior="aria" onSubmit={handleSubmit}>254 <TextField name="email" isRequired>255 <Label>Email</Label>256 <Input />257 <FieldError />258 </TextField>259 <Button type="submit">Submit</Button>260</Form>261```262263Two validation modes: `"native"` (blocks submission) and `"aria"` (realtime errors).264265## Documentation Resources266267| Resource | URL |268|----------|-----|269| React Docs | https://www.heroui.com/docs/react/getting-started |270| Native Docs | https://www.heroui.com/docs/native/getting-started |271| All React Components | https://www.heroui.com/docs/react/components |272| All Native Components | https://www.heroui.com/docs/native/components |273| Theme Builder | https://www.heroui.com/themes |274| Migration (v2 to v3) | https://www.heroui.com/docs/react/migration |