mcpField
R
radix-primitives

radix-primitives

github.com/yonatangrossDesign & UI29946 installsUpdated today
Repository

About radix-primitives

radix-primitives is a skill covering unstyled, accessible React primitives for building custom design systems and complex interfaces. It explains patterns such as polymorphic composition, keyboard and focus behavior, and styling through data attributes.

Key features

  1. 01Accessible React UI primitives
  2. 02Dialog, menu, and popover patterns
  3. 03Polymorphic composition with asChild
  4. 04Keyboard navigation and focus management
  5. 05ARIA and screen-reader support
  6. 06State-based data attributes

Use cases

  1. 01Build custom-styled accessible components
  2. 02Create dialogs, menus, and tooltips
  3. 03Compose elements without wrapper divs
  4. 04Style component states with data attributes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/yonatangross/orchestkit --skill radix-primitives

After installing, type/radix-primitivesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

checklists/
accessibility-audit.md
references/
aschild-composition.md
dialog-modal-patterns.md
dropdown-menu-patterns.md
focus-management.md
popover-tooltip-patterns.md
scripts/
composed-trigger.tsx
custom-dialog.tsx
custom-dropdown.tsx

Details

From the project README

Radix Primitives

Unstyled, accessible React components for building high-quality design systems.

Overview

  • Building custom styled components with full accessibility
  • Understanding how shadcn/ui works under the hood
  • Need polymorphic composition without wrapper divs
  • Implementing complex UI patterns (modals, menus, tooltips)

Primitives Catalog

Overlay Components
PrimitiveUse Case
DialogModal dialogs, forms, confirmations
AlertDialogDestructive action confirmations
SheetSide panels, mobile drawers
Popover Components
PrimitiveUse Case
PopoverRich content on trigger
TooltipSimple text hints
HoverCardPreview cards on hover
ContextMenuRight-click menus
Menu Components
PrimitiveUse Case
DropdownMenuAction menus
MenubarApplication menubars
NavigationMenuSite navigation
Form Components
PrimitiveUse Case
SelectCustom select dropdowns
RadioGroupSingle selection groups
CheckboxBoolean toggles
SwitchOn/off toggles
SliderRange selection
Disclosure Components
PrimitiveUse Case
AccordionExpandable sections
CollapsibleSingle toggle content
TabsTabbed interfaces

Core Pattern: asChild

The asChild prop enables polymorphic rendering without wrapper divs:

// Without asChild - creates nested elements
<Button>
  <Link href="/about">About</Link>
</Button>

// With asChild - merges into single element
<Button asChild>
  <Link href="/about">About</Link>
</Button>

How it works:

  • Uses Radix's internal Slot component
  • Merges props from parent to child
  • Forwards refs correctly
  • Combines event handlers (both fire)
  • Merges classNames

Built-in Accessibility

Every primitive includes:

  • Keyboard navigation: Arrow keys, Escape, Enter, Tab
  • Focus management: Trap, return, visible focus rings
  • ARIA attributes: Roles, states, properties
  • Screen reader: Proper announcements

Styling with Data Attributes

Radix exposes state via data attributes:

/* Style based on state */
[data-state="open"] { /* open styles */ }
[data-state="closed"] { /* closed styles */ }
[data-disabled] { /* disabled styles */ }
[data-highlighted] { /* keyboard focus */ }
// Tailwind arbitrary variants
<Dialog.Content className="data-[state=open]:animate-in data-[state=closed]:animate-out">

Quick Reference

import { Dialog, DropdownMenu, Tooltip } from 'radix-ui'

// Basic Dialog
<Dialog.Root>
  <Dialog.Trigger>Open</Dialog.Trigger>
  <Dialog.Portal>
    <Dialog.Overlay />
    <Dialog.Content>
      <Dialog.Title>Title</Dialog.Title>
      <Dialog.Description>Description</Dialog.Description>
      <Dialog.Close>Close</Dialog.Close>
    </Dialog.Content>
  </Dialog.Portal>
</Dialog.Root>

Key Decisions

DecisionRecommendation
Styling approachData attributes + Tailwind arbitrary variants
CompositionUse asChild to avoid wrapper divs
AnimationCSS-only with data-state selectors
Form componentsCombine with react-hook-form

Related Skills

  • shadcn-patterns - Pre-styled Radix components
  • focus-management - Accessibility patterns
  • design-system-starter - Design system foundation

References

Comments

Markdown supported