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

@primitiv-ui/react

v0.2.15

Published

Headless, accessible React components built on the WAI-ARIA authoring patterns. Zero styles ship with this package — bring your own (CSS, Tailwind, CSS-in-JS, design tokens).

Readme

@primitiv-ui/react

Headless, accessible React components built on the WAI-ARIA authoring patterns. Zero styles ship with this package — style them with whatever system you use (CSS, Tailwind, CSS-in-JS, design tokens, etc.).

Installation

npm i @primitiv-ui/react
import { Tabs } from "@primitiv-ui/react";

The npm package ships compiled JavaScript with type declarations, so it works with any bundler and any tsconfig — including the defaults from npm create vite and create-next-app — and loads in plain Node for SSR and tests. (JSR serves the TypeScript source.)

Next.js App Router and Server Components

Every component module is marked "use client", so you can import from @primitiv-ui/react directly in a Server Component — the client boundary forms at the component itself.

One limit comes from React, not Primitiv: a Server Component cannot reach into a client component's properties, so the compound form (Tabs.Root) only works inside a "use client" file. In a Server Component, use the flat exports every compound also provides:

// app/page.tsx — a Server Component
import { TabsRoot, TabsList, TabsTrigger, TabsContent } from "@primitiv-ui/react";

Components

| Component | Description | | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | AccessibleIcon | Accessible name for an icon-only control — clones a single decorative icon with aria-hidden/focusable="false" and pairs it with a VisuallyHidden text label | | Accordion | WAI-ARIA Accordion pattern — collapsible sections with keyboard navigation, controlled/uncontrolled state, multiple mode, and asChild composition | | Alert | WAI-ARIA alert role — an assertive live region for high-priority, time-sensitive messages, rendered conditionally so it announces on appearance, with asChild composition | | Avatar | User image with a graceful fallback — a compound component tracking the image load lifecycle (including browser cache hits), an optional delayMs to avoid a flash of fallback content, data-status styling hooks, and asChild composition | | Breadcrumb | WAI-ARIA Breadcrumb pattern — stateless compound component: a <nav> landmark wrapping an ordered list of ancestor-page links, decorative separators with a configurable glyph, an aria-current current page, and asChild composition on the link | | Button | Headless semantic <button> with type="button" default, ref forwarding, disabled with data-disabled styling hook, and asChild composition | | Carousel | WAI-ARIA Carousel pattern — compound component built on native CSS scroll-snap with swipe support, keyboard navigation, slide indicators, optional auto-rotation with WCAG 2.2.2 pause behaviour, and asChild composition | | Checkbox | A real, visually-hidden native <input type="checkbox"> in a <label> box, so it participates in forms; the platform tri-state (indeterminate → aria-checked="mixed", :indeterminate), controlled/uncontrolled state, Indicator mark, and asChild on the indicator | | CheckboxCard | WAI-ARIA Checkbox pattern in a card/tile layout — the entire card surface is the interactive element, with tri-state support, controlled/uncontrolled state, Indicator slot, disabled with data-disabled styling hook, and asChild composition | | Collapsible | Single-panel show/hide — boolean controlled/uncontrolled state, disabled, asChild composition with explicit Enter/Space handling, forceMount for CSS-Grid-driven animation, and TriggerIcon slot | | Combobox | WAI-ARIA APG Combobox pattern — an editable text field with a filtered popup listbox, using the same virtual-focus cursor as Listbox (aria-activedescendant on the input, data-highlighted on the item) so DOM focus never leaves the field; filtering is deliberately consumer-owned (no filter prop — onQueryChange reports keystrokes and you render the matches), the input holds the live query while open and resets from the committed value on Enter, Escape or a click outside — the panel is a popover="auto", so the browser supplies both the top layer and light dismiss rather than a hand-rolled outside-click listener, and all three gestures land in the same state; emptying the field clears the value too (onValueChange("")), so a reset can never resurrect a label the user just deleted; arrow keys seed the cursor on the first/last item, an Empty part keeps the panel's height while nothing matches, controlled/uncontrolled open and value, and asChild on every part | | ContextMenu | WAI-ARIA Menu pattern for right-click / long-press / context-key menus — native HTML popover compound component positioned at the cursor, with nested submenus, checkbox and radio items, ItemIndicator icon slot, groups and labels, keyboard navigation, typeahead, disabled-item skipping, onSelect escape hatch, and asChild composition | | DirectionProvider | Reading-direction context — broadcasts ltr/rtl to descendants and exposes the useDirection hook so direction-aware components inherit dir instead of each being passed it explicitly; renders no DOM | | Divider | WAI-ARIA separator role — horizontal or vertical content separator, with semantic and decorative use | | Drawer | Edge-anchored dialog — a thin composition over Modal that reuses its native <dialog> machinery (focus trap, inert background, top layer, Esc, bounding-rect click-outside, controlled/uncontrolled state, imperative API, asChild, forceMount), adding a side (top/right/bottom/left) axis emitted as data-side for the styled layer to slide the panel from that edge | | Dropdown | WAI-ARIA Menu Button / Menu pattern — native HTML popover compound component with nested submenus, checkbox and radio items, ItemIndicator icon slot, groups and labels, keyboard navigation, typeahead, disabled-item skipping, onSelect escape hatch, and asChild composition | | EmptyState | Placeholder for empty collections, searches, and views — stateless compound component: a role="status" live region announcing on appearance, an aria-hidden Media illustration slot, Title and Description copy, an Actions recovery slot, and asChild composition on every part | | Field | Headless form-field coordinator — provides FieldContext with auto-generated id (via useId) and derived descriptionId / errorId, plus invalid / disabled / required cascade; sub-components for Label (htmlFor-wired), Description, and ErrorText (auto-gated by invalid state, role="alert"); Input opts in automatically when nested | | Fieldset | Headless form-control grouping — a stateless <fieldset> / <legend> compound with an implicit group role, a legend-supplied accessible name, and disabled (cascading to every nested control) with a data-disabled styling hook | | Input | Headless single-line text input — native <input> with type="text" default, full attribute pass-through (works directly with react-hook-form's register spread), ref forwarding, native constraint validation, disabled with data-disabled styling hook, and asChild composition | | InputGroup | Stateless frame for Input (or any framed control) with named leading and trailing adornment slots — decorative icons, currency symbols, clear buttons, password-reveal toggles; data-input-group / data-input-group-adornment styling hooks, CSS-driven disabled / invalid / focus-within state via :has(), and asChild composition on every part | | Listbox | WAI-ARIA APG Listbox pattern — a persistently-visible option list using a virtual-focus cursor (aria-activedescendant on the root, data-highlighted on the option) rather than a roving tabstop, so an external input can hold DOM focus and drive the list; single/multiple selection with APG's Shift+Arrow / Ctrl+Shift+Home-End / Ctrl+A range shortcuts, opt-in selectionFollowsFocus, prefix typeahead, groups named by prop or visible GroupLabel, disabled options, DOM-order navigation that survives in-place reordering, orientation/RTL, and asChild composition on every part | | MillerColumns | Miller columns / cascading-lists pattern — a horizontal strip of role="group" columns of role="treeitem" items, authored by recursive composition with portal-projected child columns, controlled/uncontrolled active path, single-tabstop roving keyboard navigation, disabled items, and asChild composition | | Modal | WAI-ARIA Modal Dialog pattern — native <dialog>-based compound component with Portal, bounding-rect click-outside, controlled/uncontrolled state, escape hatches, imperative API, asChild, and forceMount animation hooks | | NavigationMenu | ARIA APG Disclosure Navigation Menu pattern — the desktop dropdown site nav: <nav> landmark + <ul> of entries, one panel open at a time ("" means closed), hover-intent open with instant switching and a nav-wide close grace, axis/RTL-aware arrow travel that keeps every entry in the tab order (not a roving tabindex), cross-axis arrow to enter a panel, Escape-to-close with focus return, an optional Viewport panels portal into so the open one morphs into the next, an optional Indicator publishing the open trigger's measured geometry as custom properties, and a Link carrying aria-current that the composed mobile nav (Drawer + Collapsible) reuses | | Popover | WAI-ARIA non-modal dialog — native HTML Popover API (popover="auto") compound with trigger/anchor/content/close/title/description, controlled/uncontrolled state, light-dismiss sync, focus-in-on-open + Escape focus-return (no focus trap), CSS-anchor-positioning placement, and asChild composition | | Portal | DOM-escape utility — renders children into document.body (or a consumer-supplied container) via createPortal; compose with any component that needs to break out of the current stacking context | | Progress | WAI-ARIA progressbar pattern — display-only compound component reflecting a consumer-supplied value, with determinate/indeterminate states, configurable max, getValueLabel for aria-valuetext, data-* styling hooks on the fill Indicator, and asChild composition | | Radio | Standalone — a real, visually-hidden native <input type="radio"> in a <label> box, so siblings sharing a name form a native radio group (the browser enforces single-selection) and it participates in forms; controlled/uncontrolled state, Indicator dot, disabled with data-disabled styling hook, and asChild on the indicator (use RadioGroup for managed roving-tabindex sets) | | RadioCard | WAI-ARIA Radio Group pattern in a card/tile layout — the entire card surface is the interactive element, with single-selection state, roving tabindex, arrow-key navigation, disabled-item skipping, Indicator slot, and asChild composition | | RadioGroup | WAI-ARIA Radio Group pattern — native <button role="radio"> items with single-selection state, roving tabindex, arrow-key navigation, disabled-item skipping, Indicator slot, and asChild composition | | SegmentedControl | Single-select value picker (WAI-ARIA Radio Group semantics) styled as a linear pill strip — native <button role="radio"> segments with controlled/uncontrolled state, roving tabindex, arrow-key navigation, horizontal/vertical orientation, per-item and whole-control disabled, data-state / data-orientation / data-disabled styling hooks, and asChild composition (use ToggleGroup for on/off command toggles) | | Select | Headless wrapper over native <select> / <option> / <optgroup> — controlled/uncontrolled state via onValueChange, Select.Placeholder with auto-defaultValue inference, Select.Group for optgroup labelling, data-disabled styling hook, asChild composition, and Field-aware (opts into FieldContext for auto-wired id / aria-describedby / aria-invalid / disabled / required) | | SkipNav | WCAG 2.4.1 Bypass Blocks technique — a stateless "skip to main content" link and its tabIndex=-1 focus target, connected by a shared content id, working with no JavaScript at runtime | | Slider | WAI-ARIA Slider & Multi-Thumb Slider pattern — an array-valued range input with any number of independently focusable thumbs, keyboard and pointer dragging, min/max/step, minStepsBetweenThumbs, horizontal/vertical orientation, RTL and inverted direction, onValueCommit, hidden inputs for form submission, disabled with data-disabled styling hook, and asChild composition | | SplitButton | One primary action plus a menu of related alternatives, bound into a single role="group" widget — a composition over Dropdown that adds the coordination Dropdown alone can't provide: the group boundary, the menu trigger's accessible name derived from the primary action (so a chevron-only control is never unlabelled), disabled propagating from the group to both halves, and ArrowDown on the action opening the menu; both halves stay independently tabbable, and asChild composition is available on the group and the action | | Status | WAI-ARIA status role — a polite live region for low-priority, non-urgent status messages, announced once the user is idle, with asChild composition | | Switch | A real, visually-hidden native <input type="checkbox" role="switch"> in a <label> track, so it participates in forms; binary on/off state, always-mounted Thumb for CSS-driven sliding (off the input's native :checked), controlled/uncontrolled state, data-disabled styling hook, and asChild on the thumb | | Table | WAI-ARIA Table pattern — compound component wrapping standard HTML table elements with accessible headers, captions, a responsive scroll wrapper, and an opt-in expandable-row disclosure | | Tabs | WAI-ARIA Tabs pattern — compound component with keyboard navigation, controlled/uncontrolled state, and asChild composition | | Textarea | Headless multi-line text input — native <textarea> with full attribute pass-through, ref forwarding, disabled with data-disabled styling hook, asChild composition for wrapping autosizing implementations, and Field-aware (opts into FieldContext for auto-wired id / aria-describedby / aria-invalid / disabled / required) | | Toggle | WAI-ARIA Button pattern with aria-pressed — single stateful toggle button with controlled/uncontrolled state, data-state styling hook, and asChild composition | | ToggleGroup | Grouped toggle buttons with roving-tabindex keyboard navigation — type="single" (at most one pressed, re-press deselects) or type="multiple" (items toggle independently), controlled/uncontrolled state, disabled-item skipping, and asChild composition | | Tooltip | WAI-ARIA Tooltip pattern — hover/focus-triggered description panel with configurable delay, skip-delay across multiple tooltips, grace period for hoverable content, CSS-anchor-positioning placement (no JS measurement), Portal, controlled/uncontrolled state, and asChild composition | | Tree | WAI-ARIA Tree pattern — hierarchical tree view authored by recursive composition with Branch/BranchControl/BranchContent, controlled/uncontrolled expansion, single or multiple selection with Ctrl/Cmd and Shift+click range, forceMount for branch animation, single-tabstop roving keyboard navigation, disabled items, and asChild composition | | VisuallyHidden | Screen-reader-only primitive — visually hides its children with the canonical clip styles while keeping them in the accessibility tree, with consumer style merging and asChild composition |

Hooks

| Hook | Description | | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | useMediaQuery | Tracks whether a CSS media query currently matches, re-rendering on change — generic, not tied to Primitiv's own breakpoint scale, with a safe false default during server rendering | | usePagination | Page state and arithmetic for any paged data source — clamped current page, prev/next/first/last, half-open startIndex/endIndex slice bounds for client- or server-side data, and the collapsed page range to render |

Internal utilities

Slot is the asChild composition utility used internally by components such as Tabs.Trigger. It is not a public component API. The hooks/ directory (useCollection, useControllableState, useRovingTabindex) is similarly internal — shared implementation details of compound components, not part of the public API.

Testing

Tests use Vitest and Testing Library.

# Run all component tests once
npx vitest run

# Watch mode
npx vitest

# With coverage
npx vitest run --coverage