React Aria Components: Higher-Level Wrappers
You'll learn how React Aria Components provide pre-composed, Radix-like components that wrap the hooks you've already seen.
The Best of Both Worlds
You've used React Aria's hooks (like useButton) to build accessible components from scratch. But sometimes you want faster development without sacrificing accessibility. React Aria Components (RAC) solves this by providing pre-built component wrappers around those same hooks.
Think of it like this: React Aria hooks are like buying ingredients and cooking from scratch. React Aria Components are like buying a meal kit with pre-measured ingredients — still customizable, but with less setup.
What RAC Provides
Instead of calling useButton and spreading props manually, you use a <Button> component that does that internally:
// React Aria Hooks approach (what you've learned):
import {useButton} from 'react-aria';
function MyButton(props) {
const ref = useRef();
const {buttonProps} = useButton(props, ref);
return <button {...buttonProps} ref={ref}>{props.children}</button>;
}
// React Aria Components approach (new layer):
import {Button} from 'react-aria-components';
function MyButton(props) {
return <Button>{props.children}</Button>;
}
The Architecture
RAC components are wrappers around React Aria hooks. Under the hood, they're doing exactly what you would do manually: calling hooks, managing refs, spreading props. They follow compound component patterns (like Radix) for complex widgets like Dialogs and Menus.
You still style them yourself (they're headless), but you get:
- Automatic accessibility
- State management built-in
- Compound component ergonomics
- Data attributes for styling states
Key Takeaway: React Aria Components layer pre-composed components over hooks, giving you Radix-like ergonomics with the same accessibility foundation — choose hooks for maximum control or components for faster development.