--- name: radix-ui description: >- Build accessible UI primitives with Radix UI. Use when creating accessible dropdowns, dialogs, popovers, tabs, tooltips, or building a design system with unstyled, composable components. license: Apache-2.0 compatibility: 'React 18+' metadata: author: terminal-skills version: 1.0.0 category: development tags: [radix-ui, accessibility, components, react, primitives] --- # Radix UI ## Overview Radix UI provides unstyled, accessible React primitives — dropdowns, dialogs, popovers, tabs, accordions, and more. Each component handles keyboard navigation, focus management, screen reader support, and ARIA attributes. You add your own styling. Foundation of shadcn/ui. ## Instructions ### Step 1: Dialog ```tsx import * as Dialog from '@radix-ui/react-dialog' function ConfirmDialog({ trigger, title, description, onConfirm }) { return ( {trigger} {title} {description}
) } ``` ### Step 2: Dropdown Menu ```tsx import * as DropdownMenu from '@radix-ui/react-dropdown-menu' function UserMenu({ user }) { return ( Profile Settings Sign out ) } ``` ### Step 3: Tabs ```tsx import * as Tabs from '@radix-ui/react-tabs' Overview Analytics ``` ## Guidelines - Radix is unstyled — bring your own CSS/Tailwind. For pre-styled, use shadcn/ui. - `asChild` merges Radix behavior onto your custom elements (no extra DOM wrappers). - `data-[state=active]` and `data-[state=open]` for styling based on component state. - Install individual packages: `@radix-ui/react-dialog`, `@radix-ui/react-dropdown-menu`. - All components handle keyboard (Escape, Arrow keys, Enter) and screen readers automatically.