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

@cujuju/solidjs-tri-state-chip

v0.1.0

Published

Tri-state filter chip for SolidJS — include / exclude / neutral cycling, theme via CSS vars, plus pure state helpers (cycleTriState, applyTriState, tristateOf).

Downloads

80

Readme

@cujuju/solidjs-tri-state-chip

A single tri-state filter chip for SolidJS. One button cycling unselectedincludedexcludedunselected on click. Ships pure state helpers (cycleTriState, applyTriState, tristateOf, EMPTY_TRI_STATE) so callsites can manage upstream TriStateValue shape without re-implementing the disjoint-set math.

Not a popover. Just the chip. Drop it inside whatever filter shell you already have (popover, inline bar, drawer) — the panel, dismissal, and viewport clamping are your concern.

Install

pnpm add @cujuju/solidjs-tri-state-chip

Stylesheet is side-effect-imported via the entrypoint; or import '@cujuju/solidjs-tri-state-chip/styles.css' manually.

Usage

import {
  TriStateChip,
  applyTriState,
  tristateOf,
  EMPTY_TRI_STATE,
  type TriStateValue,
} from '@cujuju/solidjs-tri-state-chip';
import { createSignal, For } from 'solid-js';

const [value, setValue] = createSignal<TriStateValue>(EMPTY_TRI_STATE);
const options = ['action', 'comedy', 'drama'];

<For each={options}>
  {(opt) => (
    <TriStateChip
      label={opt}
      value={tristateOf(value(), opt)}
      onCycle={(next) => setValue(applyTriState(value(), opt, next))}
    />
  )}
</For>

API — <TriStateChip>

| Prop | Default | Description | |---|---|---| | label | (required) | Chip body content. Plain text or JSX. | | value | (required) | Current state: 'unselected' / 'included' / 'excluded'. | | onCycle | (required) | Fires with the next state on click. | | disabled | false | Non-interactive, dimmed. | | nextState | cycleTriState | Override the cycle order. | | includePrefix | '+ ' | Glyph shown before the label when included. Pass '' to suppress. | | excludePrefix | '− ' | Glyph shown before the label when excluded. | | ariaLabel | — | Override for screen readers. | | class, style, dataAttr | — | Passthrough. |

API — state helpers

type TriState = 'unselected' | 'included' | 'excluded';
interface TriStateValue { included: string[]; excluded: string[] }

const EMPTY_TRI_STATE: TriStateValue;
cycleTriState(current: TriState): TriState;
tristateOf(value: TriStateValue, item: string): TriState;
applyTriState(value: TriStateValue, item: string, next: TriState): TriStateValue;

All pure, no Solid dependency — safe to import in stores, tests, or workers.

Theming

:root {
  --ctc-bg: transparent;
  --ctc-color: inherit;
  --ctc-border: 1px solid currentColor;
  --ctc-border-hover: 1px solid #6366f1;

  --ctc-bg-included: rgba(16, 185, 129, 0.15);
  --ctc-color-included: #10b981;
  --ctc-border-included: 1px solid #10b981;
  --ctc-bg-included-hover: rgba(16, 185, 129, 0.25);

  --ctc-bg-excluded: rgba(244, 63, 94, 0.15);
  --ctc-color-excluded: #f43f5e;
  --ctc-border-excluded: 1px solid #f43f5e;
  --ctc-bg-excluded-hover: rgba(244, 63, 94, 0.25);

  --ctc-padding: 5px 10px;
  --ctc-radius: 6px;
  --ctc-font-size: 0.875rem;
  --ctc-font-weight: 500;
  --ctc-transition: 150ms ease;
  --ctc-disabled-opacity: 0.5;
  --ctc-focus-ring: 2px solid #6366f1;
  --ctc-focus-ring-offset: 2px;
}

A11y

The chip emits aria-pressed="true" when the state is included or excluded, and aria-pressed="false" when unselected. The include-vs-exclude distinction is carried visually (color, prefix glyph) and via data-state="included" | "excluded" | "unselected" on the root for CSS / automation. aria-pressed="mixed" is intentionally NOT used — per W3C, mixed is reserved for partially-selected groups, not for distinguishing two pressed flavors of a single toggle. Pass ariaLabel="Genre: action (included)" from the consumer if richer screen-reader output is needed.

License

MIT