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

@structyl/primitives

v1.1.1

Published

Headless, WAI-ARIA accessible React primitives with compound APIs, asChild slots, and controlled/uncontrolled state — behavior without styling.

Readme

@structyl/primitives

Headless, accessible React behavior primitives — structure without styling.

npm license

@structyl/primitives is the headless behavior layer of structyl. It provides unstyled, WAI-ARIA compliant React components — dialogs, menus, selects, date pickers, and dozens more — that ship full keyboard navigation, focus management, and accessibility while leaving styling entirely up to you. It is the foundation that @structyl/styled builds on, and it's also a complete toolkit on its own for teams that bring their own design system.

Installation

# pnpm
pnpm add @structyl/primitives

# npm
npm install @structyl/primitives

# yarn
yarn add @structyl/primitives

React 18 or 19 (and the matching react-dom) are required as peer dependencies.

Usage

Multi-part components use a compound, dot-notation API. Every primitive is unstyled — apply your own classes or styles.

import { Dialog, Button } from '@structyl/primitives';

export function Example() {
  return (
    <Dialog.Root>
      <Dialog.Trigger asChild>
        <Button>Open dialog</Button>
      </Dialog.Trigger>
      <Dialog.Portal>
        <Dialog.Overlay />
        <Dialog.Content>
          <Dialog.Title>Confirm action</Dialog.Title>
          <Dialog.Description>This cannot be undone.</Dialog.Description>
          <Dialog.Close asChild>
            <Button>Cancel</Button>
          </Dialog.Close>
        </Dialog.Content>
      </Dialog.Portal>
    </Dialog.Root>
  );
}

Stateful primitives support both controlled and uncontrolled usage:

import { Dialog } from '@structyl/primitives';

// Uncontrolled
<Dialog.Root defaultOpen={false}>{/* ... */}</Dialog.Root>

// Controlled
<Dialog.Root open={open} onOpenChange={setOpen}>{/* ... */}</Dialog.Root>

Features

  • Accessible by default — WAI-ARIA APG patterns, correct roles and attributes, and full keyboard support for every interaction.
  • Headless — zero styling shipped; render with Tailwind, CSS Modules, or anything else.
  • Compound APIs — composable dot-notation parts (Dialog.Root, Dialog.Trigger, Dialog.Content, …).
  • asChild slots — merge behavior onto your own element or component instead of an extra wrapper.
  • Controlled & uncontrolled — every stateful primitive works both ways via value/defaultValue plus change handlers.
  • Ref forwarding — all primitives forward refs to their underlying DOM node.
  • TypeScript-first — strict types and exported prop types for every component.
  • SSR / RSC friendly — tested in the Next.js App Router.

API

The package exports both standalone primitives and namespaced compound components. A selection of the main exports:

| Export | Type | Description | | --- | --- | --- | | Button | component | Accessible button with asChild and loading state | | Rating | component | Star/icon rating input | | Dialog | namespace | Modal dialog (Root, Trigger, Portal, Overlay, Content, Title, Description, Close) | | AlertDialog | namespace | Confirmation dialog with required action affordances | | Popover / Tooltip / HoverCard | namespace | Floating overlays | | DropdownMenu / ContextMenu / Menubar / Menu | namespace | Menu patterns | | NavigationMenu / Breadcrumb / Pagination / Stepper | namespace | Navigation | | Select / MultiSelect / Combobox / Command | namespace | Listbox & command palette inputs | | Tabs / Accordion / Collapsible | namespace | Disclosure & sectioned content | | RadioGroup / ToggleGroup / Slider / Form | namespace | Form controls | | Calendar / DatePicker / DateRangePicker / TimePicker / DateTimePicker | namespace | Date & time pickers | | ColorPicker / FileUpload / TagsInput / Mentions / Editable | namespace | Specialty inputs | | NumberField / OneTimePasswordField / PasswordToggleField | namespace | Specialty form fields | | ScrollArea / Resizable / Carousel / Tree / Toolbar | namespace | Layout & utility | | Avatar / Progress / Toast / Card / Chart | namespace | Display & feedback | | Switch / Toggle / Checkbox / Label / Separator / Skeleton / Spinner / Badge / Alert / Input / Textarea / AspectRatio | component | Standalone primitives |

Every component ships its corresponding prop types (for example ButtonProps, DialogContentProps, SelectRootProps). See the documentation for the full API reference.

Part of structyl

Part of the structyl component library — see the full docs at www.structyl.com.

License

MIT