Svelte-HeadlessUI

svelte-headlessui is an unofficial implementation of Tailwind HeadlessUI for Svelte. Just like the official implementation, they are:

  • ✅ Completely unstyled
  • ✅ Fully WAI-ARIA accessible UI components
  • ✅ Fully typed with Typescript
  • ✅ Designed to integrate beautifully with Tailwind CSS

But also:

  • ✅ Designed to integrate easily with Svelte and SvelteKit
  • ✅ Only 14kB minified / 4kB minified + gzipped

minified minified zipped

Installation

Install using your package manager of choice, e.g.

pnpm install svelte-headlessui

Import the appropriate create... factory method in your component and use the custom store it returns to manage your component state and attach use:action behaviors to your elements.

See the individual component pages for usage examples.

NOTE: Some of the examples use svelte-transition to apply TailwindCSS animation classes. This is a separate package, not to be confused with the svelte/transition module built into Svelte itself.

Alternative

You may be interested in evaluating @rgossiaux/svelte-headlessui. This package aligns closer to the official components in it's approach although I believe that approach (driven by React / Vue) contributes to the 10x larger size of 140.1kB minified javascript.

Logo

Special thanks to Shoob for the awesome logo!