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

@zag-js/cascade-select

v1.35.2

Published

Core logic for the cascade-select widget implemented as a state machine

Readme

@zag-js/cascade-select

Core logic for the cascade select widget implemented as a state machine

A comprehensive state machine for building cascade select (cascading dropdowns) components with hierarchical data navigation.

Features

🌳 Hierarchical Data Support

  • Navigate through nested data structures (continents → countries → states)
  • Support for unlimited depth levels
  • Dynamic level generation based on data structure
  • Efficient tree collection management

⌨️ Full Keyboard Navigation

  • Arrow keys: Navigate between items and levels
  • Home/End: Jump to first/last item at any level
  • Enter/Space: Select items or navigate into children
  • Escape: Close dropdown and return focus
  • Arrow Left/Right: Navigate between parent and child levels

🎯 Flexible Selection Modes

  • Single selection: Choose one complete path
  • Multiple selection: Select multiple paths simultaneously
  • Parent selection: Allow selection of non-leaf items (optional)
  • Leaf-only selection: Restrict selection to final items only

🎨 Interaction Models

  • Click highlighting: Navigate by clicking items
  • Hover highlighting: Navigate by mouse hover with grace areas
  • Mixed interaction: Combine click and hover behaviors
  • Touch-friendly: Optimized for mobile interactions

Accessibility Built-in

  • ARIA compliance: Proper roles, states, and properties
  • Screen reader support: Descriptive labels and live regions
  • Focus management: Logical tab order and focus restoration
  • Keyboard-only operation: Complete functionality without mouse

🎛️ Customizable Behavior

  • Auto-close options: Control when dropdown closes after selection
  • Custom separators: Configure path display formatting
  • Disabled items: Mark items as non-selectable
  • Read-only mode: Display-only state
  • Loop navigation: Circular navigation within levels

📱 UI Integration

  • Positioning system: Intelligent dropdown placement with collision detection
  • Scroll management: Auto-scroll highlighted items into view
  • Level indicators: Visual representation of navigation depth
  • Loading states: Handle async data loading
  • Empty states: Graceful handling of empty data sets

🔧 Developer Experience

  • Event callbacks: onChange, onHighlight, onOpen/Close events
  • Custom formatting: Control display text and value representation
  • Form integration: Works with native form elements and validation
  • TypeScript support: Full type safety for data structures

Common Use Cases

  • Geographic selection: Country → State → City
  • Category browsing: Department → Category → Subcategory → Product
  • Organizational hierarchy: Company → Division → Team → Employee
  • File system navigation: Folder → Subfolder → File
  • Menu systems: Main Menu → Submenu → Action

Installation

yarn add @zag-js/cascade-select
# or
npm i @zag-js/cascade-select

Contribution

Yes please! See the contributing guidelines for details.

Licence

This project is licensed under the terms of the MIT license.