talira

Headless UI

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS

open sourceMITself-hostablefree

Headless UI is a set of unstyled, accessible UI components for React and Vue from Tailwind Labs, the makers of Tailwind CSS: dropdown menus, listboxes, comboboxes, dialogs, popovers, disclosures, tabs, switches, radio groups, transitions and form controls. Each component handles the keyboard navigation, focus management and ARIA attributes, and exposes its state (open, focused, selected, disabled) as data attributes and render props, so you style every state yourself, usually with Tailwind utilities such as data-focus:bg-blue-100. The React package (version 2) can anchor floating menus and popovers to their buttons; the Vue package is on version 1. It is MIT-licensed.

Problems it solves

  • I need an accessible dropdown menu with proper keyboard navigation but want to style it entirely with Tailwind
  • a searchable select box (combobox) for React that works with screen readers
  • build a modal dialog that traps focus and closes on Escape without writing the focus logic myself
  • component libraries force their look on me; I want behaviour and accessibility without any styles
  • style the open, focused and selected states of a listbox with CSS instead of JavaScript state
  • accessible tabs, switches and radio groups for a Vue app
  • animate menus and dialogs opening and closing with CSS transitions
  • position a floating menu or popover next to its button and keep it on screen

Features

  • Dropdown Menu, Listbox, Combobox, Dialog, Popover, Disclosure, Tabs and Transition components
  • form components: Button, Checkbox, Fieldset, Input, Radio Group, Select, Switch and Textarea
  • keyboard navigation, focus management and ARIA attributes handled for you
  • component state exposed as data attributes (data-focus, data-open, data-selected) and render props
  • anchor positioning for floating menus and popovers (React)
  • React and Vue packages
  • designed to be styled with Tailwind CSS utilities

Alternatives

The same job

These do what Headless UI does.

  1. React Aria Accessible React components and hooks with no styles
  2. Base UI Unstyled UI components for building accessible user interfaces
  3. Radix UI Core building blocks for your design system
  4. Ark UI Unstyled, accessible UI components for your design system. Works in React, Vue, Solid, and Svelte.
  5. Bits UI The headless components for Svelte

Compare Headless UI with the top 3