@radix-ui/react-slot
Radix UI is a collection of unstyled, accessible React component primitives for building high-quality design systems and web applications. Each component (Dialo…
Installation
npm install @radix-ui/react-dialog
yarn add @radix-ui/react-dialog
pnpm add @radix-ui/react-dialog
Import
import * as Dialog from '@radix-ui/react-dialog';
Quick Example
import * as Dialog from '@radix-ui/react-dialog';
function MyDialog() {
return (
<Dialog.Root>
<Dialog.Trigger>Open</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Overlay className="fixed inset-0 bg-black/50" />
<Dialog.Content className="fixed bg-white rounded-lg p-6">
<Dialog.Title>Title</Dialog.Title>
<Dialog.Close>Close</Dialog.Close>
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
);
}About @radix-ui/react-slot
Radix UI is a collection of unstyled, accessible React component primitives for building high-quality design systems and web applications. Each component (Dialog, Dropdown Menu, Popover, Tabs, Accordion, Toggle, Select, Tooltip, etc.) implements complex interaction patterns, keyboard navigation, focus management, and ARIA attributes correctly while providing zero visual styling. This separation of behavior from appearance gives developers complete control over the look and feel through their preferred styling approach — Tailwind CSS, CSS Modules, styled-components, or vanilla CSS. Each Radix primitive is published as a separate package (@radix-ui/react-dialog, @radix-ui/react-dropdown-menu, etc.) for tree-shaking and minimal bundle impact. Components support controlled and uncontrolled modes, composition through slots and asChild prop for custom element rendering, and animation-friendly APIs with data attributes for entry/exit states. Radix UI is the foundation for shadcn/ui, the most popular React component collection, which adds Tailwind CSS styling on top of Radix primitives. Radix's focus on accessibility means components handle screen reader announcements, keyboard shortcuts, focus trapping in modals, and ARIA attributes automatically, significantly reducing the accessibility effort in application development.
Quick Facts
| Package | @radix-ui/react-slot |
| Category | UI Component |
| Weekly Downloads | 10M+ |
| License | MIT |
| Install | npm install @radix-ui/react-dialog |
Related Packages
shadcn/ui is not a component library in the traditional sense — it is a collection of reusable, beau…
Headless UI is a collection of completely unstyled, fully accessible React and Vue UI components des…
React is the most popular JavaScript library for building user interfaces, developed and maintained …
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes for building c…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.