@headlessui/react
Headless UI is a collection of completely unstyled, fully accessible React and Vue UI components designed to integrate seamlessly with Tailwind CSS. Developed b…
Installation
npm install @headlessui/react
yarn add @headlessui/react
pnpm add @headlessui/react
Import
import { Menu } from '@headlessui/react';Quick Example
import { Menu } from '@headlessui/react';
function Dropdown() {
return (
<Menu>
<Menu.Button className="px-4 py-2 bg-blue-500 text-white rounded">
Options
</Menu.Button>
<Menu.Items className="mt-1 bg-white rounded shadow-lg">
<Menu.Item>
{({ active }) => (
<a className={active ? 'bg-blue-100' : ''} href="/edit">Edit</a>
)}
</Menu.Item>
</Menu.Items>
</Menu>
);
}About @headlessui/react
Headless UI is a collection of completely unstyled, fully accessible React and Vue UI components designed to integrate seamlessly with Tailwind CSS. Developed by the Tailwind Labs team, Headless UI provides the interactive behavior, accessibility features, keyboard navigation, and focus management for common UI patterns — Menu (Dropdown), Listbox (Select), Combobox (Autocomplete), Switch (Toggle), Dialog (Modal), Popover, Disclosure (Accordion), Tabs, Radio Group, and Transition — without any visual styling. Each component renders semantic HTML with proper ARIA attributes, handles keyboard interactions according to WAI-ARIA design patterns, manages focus correctly, and supports screen readers out of the box. Components use a render prop or slot-based API that gives you complete control over the rendered markup and styling. Headless UI is designed specifically for use with Tailwind CSS, where you apply utility classes directly to each component element. The library is smaller and more focused than Radix UI, covering fewer component types but integrating particularly well with the Tailwind CSS workflow. Headless UI is the recommended accessibility layer for Tailwind CSS projects that don't use shadcn/ui.
Quick Facts
| Package | @headlessui/react |
| Category | UI Component |
| Weekly Downloads | 3M+ |
| License | MIT |
| Install | npm install @headlessui/react |
Related Packages
Radix UI is a collection of unstyled, accessible React component primitives for building high-qualit…
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes for building c…
shadcn/ui is not a component library in the traditional sense — it is a collection of reusable, beau…
React is the most popular JavaScript library for building user interfaces, developed and maintained …
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.