@arshad-shah/cynosure-core
v2.1.1
Published
Cynosure UI — primitives, utilities, hooks
Downloads
249
Readme
@arshad-shah/cynosure-core
Headless primitives, hooks, and utilities that underpin Cynosure UI.
Most application developers want @arshad-shah/cynosure-react instead — it's the batteries-included component library. This package is the substrate it sits on: low-level building blocks meant for library authors, advanced consumers, and anyone assembling their own components on top of Cynosure's behaviour layer.
Explore the full component library, live: cynosure.arshadshah.com
Install
pnpm add @arshad-shah/cynosure-corePeer requirements: react >= 18, react-dom >= 18.
What's inside
- Hooks —
useId,useMergedRef,useControllableState, focus-trap utilities, keyboard-nav helpers - Utilities — DOM owner-document resolution, polymorphic
astypings, SSR-safe helpers - Primitives — unstyled behaviour wrappers that the
reactpackage composes into themed components - Types — the shared TypeScript vocabulary the rest of Cynosure's packages reference
Every export is a single-purpose building block. None of them render visible UI on their own.
Usage
import { useMergedRef, useControllableState } from '@arshad-shah/cynosure-core';
function MyInput({ value, defaultValue, onValueChange, ...props }) {
const [controlledValue, setControlledValue] = useControllableState({
prop: value,
defaultProp: defaultValue,
onChange: onValueChange,
});
// …
}Because the package has no styles, nothing is imported implicitly. There are no side effects at module load outside of the CSS files consumers explicitly opt into via subpath imports.
When to use this directly
- You're building a component library that wants Cynosure's behaviour layer without its styling decisions
- You need a Cynosure hook in a component that isn't wrapped in
@arshad-shah/cynosure-react - You're writing a custom theme or token pipeline and want to reuse the type vocabulary
If none of those apply, you probably want @arshad-shah/cynosure-react.
Links
- Storybook — live component reference
- Main repo
@arshad-shah/cynosure-react— the batteries-included component layer- Changelog
License
MIT © Arshad Shah
