Documentation Index
Fetch the complete documentation index at: https://mintlify.com/radix-ui/primitives/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before installing Radix UI Primitives, make sure you have:- Node.js 18 or later
- React 16.8 or later (requires Hooks support)
- React DOM 16.8 or later
Radix UI Primitives requires React 16.8 or newer because it uses React Hooks. It supports React 16.8, 17, 18, and 19.
Installation Methods
You can install Radix UI Primitives using your preferred package manager:Package Structure
Each Radix UI component is published as an individual package under the@radix-ui scope:
@radix-ui/react-dialog- Dialog component@radix-ui/react-accordion- Accordion component@radix-ui/react-dropdown-menu- Dropdown menu component@radix-ui/react-switch- Switch component- And many more…
Installing Multiple Components
If you need multiple components, install them individually:TypeScript Setup
Radix UI Primitives are written in TypeScript and include type definitions out of the box. No additional setup is required.Type Definitions
If you’re using TypeScript and want to ensure you have the React type definitions installed:The
@types/react and @types/react-dom packages are peer dependencies and marked as optional, but they’re recommended for TypeScript projects.Peer Dependencies
Radix UI components have the following peer dependencies:Quick Start Example
Here’s a complete example using the Dialog component:Dialog.tsx
Components are completely unstyled by default. You’ll need to add your own styles. See the Styling guide for different approaches.
Version Compatibility
Radix UI follows semantic versioning. Check the changelog for each component to see breaking changes and migration guides.Using with Frameworks
Next.js
Radix UI works seamlessly with Next.js. Simply install and import components as shown above.app/page.tsx
Remix
Radix UI works great with Remix:app/routes/index.tsx
Vite
Radix UI is fully compatible with Vite:src/App.tsx
Verifying Installation
To verify your installation is working:Troubleshooting
Module not found
If you see a “Module not found” error:- Verify the package is installed: check your
package.json - Restart your development server
- Clear your build cache
- Ensure the package name is correct (e.g.,
@radix-ui/react-dialog, not@radix-ui/dialog)
Type errors
If you’re getting TypeScript errors:- Make sure
@types/reactand@types/react-domare installed - Verify your React version is compatible (16.8+)
- Check that your
tsconfig.jsonincludes the necessary configurations
Peer dependency warnings
Peer dependency warnings are usually safe to ignore if you have React and React DOM already installed. However, make sure your versions are compatible.Next Steps
Styling
Learn how to style your components
Composition
Understand the composable API
Components
Explore available components
Examples
View code examples on GitHub