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

@cdx-ui/utils

v0.0.1-beta.12

Published

Shared utilities used across CDS packages.

Readme

@cdx-ui/utils

Shared utilities used across CDS packages.

Provides common helpers for styling, event handling, state management, and context propagation used by @cdx-ui/primitives and @cdx-ui/components.

Installation

pnpm add @cdx-ui/utils

Exports

Common helpers

| Export | Description | | --- | --- | | cn(...inputs) | Merges class names with clsx + tailwind-merge — conditionals and conflict resolution in one call. | | composeEventHandlers(...handlers) | Chains multiple event callbacks into a single handler; skips null/undefined entries. | | useControllableState(params) | Hook that supports both controlled and uncontrolled modes for a single value. Warns in dev if the mode switches during a component's lifetime. | | mergeRefs(...refs) | Combines multiple refs (callback or object) into one ref callback. | | flattenChildren(children) | Recursively flattens React children into a flat array (used internally for spaced-child layouts). | | ariaAttr(condition) | Returns 'true' or undefined — shorthand for boolean ARIA attribute values. |

Context

| Export | Description | | --- | --- | | createContext(displayName) | Wrapper around React's createContext that returns a [Provider, useHook] tuple. The hook throws a descriptive error if called outside the provider — eliminates silent undefined bugs. |

Style context

Used internally by @cdx-ui/components to propagate variant props (size, color, etc.) from a compound root to its sub-components.

| Export | Description | | --- | --- | | withStyleContext(Component, scope?) | HOC that adds a context prop and provides it to descendants via ParentContext. | | useStyleContext(scope?) | Reads the style context set by the nearest withStyleContext wrapper. | | useParentContext() | Reads the full StyleContextMap from the nearest provider. | | ParentContext | The raw React context (rarely needed directly). |

Form control

Low-level form-field state used by the Field and Input primitives.

| Export | Description | | --- | --- | | useFormControlRoot(props) | Creates the root state object for a form field (id generation, aria-describedby wiring). | | useFormControl(props) | Merges component-level props with inherited form-control context. | | useFormControlContext() | Reads form-control state from the nearest provider. | | FormControlContext | The raw React context for form-control state. |

Further reading