npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

alpine-headless-ui

v1.0.0

Published

Headless, accessible UI primitives for Alpine.js

Readme

Alpine Headless UI

Headless, accessible UI primitives for Alpine.js, built with https://github.com/eldomagan/alpine-define-component.

This library provides unstyled, behavior-only components inspired by:

The goal is to give you composable Alpine components with correct state management, keyboard interactions, and ARIA attributes, while leaving all styling and markup control to you.


Features

  • Headless (no styles, no markup assumptions)
  • Accessible by default (keyboard and ARIA patterns applied)
  • Per-component imports
  • Built on Alpine.js v3

Installation

npm install alpine-headless-ui

Getting started

Register all components

import Alpine from 'alpinejs'
import AlpineHeadlessUI from 'alpine-headless-ui'

Alpine.plugin(AlpineHeadlessUI)
Alpine.start()

This registers all available headless ui components globally.


Register individual components

You can import and register only the components you need.

import Alpine from 'alpinejs'
import dialog from 'alpine-headless-ui/dialog'
import menu from 'alpine-headless-ui/menu'

Alpine.plugin(dialog)
Alpine.plugin(menu)
Alpine.start()

This keeps your bundle size minimal.


Component usage

All components follow the same pattern:

  • A root element using x-<component>
  • Named parts using x-<component>:<part>
  • Optional scoped sub-parts for repeated items

The exact HTML structure is up to you.


Dialog

Example

<div x-dialog>
  <button x-dialog:trigger>Open Dialog</button>

  <div x-dialog:backdrop></div>

  <div x-dialog:positioner>
    <div x-dialog:content>
      <h2 x-dialog:title>Dialog Title</h2>
      <p x-dialog:description>
        This is a basic dialog example. Click outside or press Escape to close.
      </p>
      <button x-dialog:close-trigger>Close</button>
    </div>
  </div>
</div>

Behavior

  • Focus is trapped inside the dialog when open
  • Escape closes the dialog
  • Focus returns to the trigger on close
  • Backdrop click closes the dialog
  • Body scroll prevented when open

Accessibility

Alpine Headless UI components aim to follow WAI-ARIA authoring practices:

  • Correct roles (dialog, menu, combobox, etc.)
  • Keyboard interactions matching platform expectations
  • Focus management on open and close

Behavior patterns are inspired by Zag.js state machines, adapted to Alpine idioms.

You are responsible for:

  • Visual focus styles
  • Animations and transitions
  • Layout and spacing

Credits

Inspired by:

  • Zag.js - State machine patterns for accessible components
  • alpine-zag - Alpine.js integration with Zag.js

Created by:

📄 License

This project is open-sourced under the MIT license.