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

@tuiparts/react

v0.0.6

Published

React Adapter for tuiparts.sh Primitives

Downloads

1,092

Readme

@tuiparts/react

The React Adapter for tuiparts.sh Primitives.

New to package primitives and editable recipes? Start with the primitive and recipe guide.

Installation

Add the Adapter to an existing OpenTUI React application:

pnpm add @tuiparts/react

Peer requirements are @opentui/core and @opentui/react ^0.4.3, React >=19.2.0 <20.

Primitive example

import {
  Accordion,
  Button,
  Checkbox,
  Collapsible,
  Input,
  NumberField,
  Radio,
  RadioGroup,
  Slider,
  Switch,
  Textarea,
  Toggle,
  ToggleGroup,
} from "@tuiparts/react";
import { useState } from "react";

export function Settings() {
  const [checked, setChecked] = useState(false);
  return (
    <box flexDirection="column" gap={1}>
      <Button onPress={({ source }) => console.log(source)}>
        <text content="Run" />
      </Button>
      <Checkbox.Root checked={checked} onCheckedChange={setChecked}>
        <Checkbox.Indicator>
          <text content="✓" />
        </Checkbox.Indicator>
        <text content="Run checks" />
      </Checkbox.Root>
      <Accordion.Root defaultValue={["details"]}>
        <Accordion.Item value="details">
          <Accordion.Trigger>
            <text content="Details" />
          </Accordion.Trigger>
          <Accordion.Panel>
            <text content="Expanded content" />
          </Accordion.Panel>
        </Accordion.Item>
      </Accordion.Root>
      <Input placeholder="Release name" onSubmit={console.log} />
      <NumberField.Root defaultValue={1} min={0} max={20}>
        <NumberField.Decrement><text content="−" /></NumberField.Decrement>
        <NumberField.Input width={8} />
        <NumberField.Increment><text content="+" /></NumberField.Increment>
      </NumberField.Root>
      <Textarea initialValue="Release notes" onSubmit={console.log} />
      <Slider.Root defaultValue={25} max={100}>
        <Slider.Track width={20}><text content="────────────────────" /></Slider.Track>
      </Slider.Root>
      <Switch.Root checked={checked} onCheckedChange={setChecked}>
        {(state) => <text content={state.checked ? "On" : "Off"} />}
      </Switch.Root>
      <RadioGroup defaultValue="stable">
        <Radio.Root value="stable">
          <text content="Stable" />
        </Radio.Root>
      </RadioGroup>
      <Toggle defaultPressed>
        {(state) => <text content={state.pressed ? "Pinned" : "Unpinned"} />}
      </Toggle>
      <ToggleGroup defaultValue={["bold"]} multiple>
        <Toggle value="bold"><text content="Bold" /></Toggle>
        <Toggle value="italic"><text content="Italic" /></Toggle>
      </ToggleGroup>
    </box>
  );
}

From a repository checkout, run a focused tracer with pnpm --filter @tuiparts/react demo:number-field, pnpm --filter @tuiparts/react demo:slider, pnpm --filter @tuiparts/react demo:checkbox-group, pnpm --filter @tuiparts/react demo:accordion, or pnpm --filter @tuiparts/react demo:collapsible.

Imports

All Primitives are exported from @tuiparts/react. Focused imports are also supported:

import { Accordion } from "@tuiparts/react/accordion";
import { Button } from "@tuiparts/react/button";
import { Checkbox } from "@tuiparts/react/checkbox";
import { CheckboxGroup } from "@tuiparts/react/checkbox-group";
import { Collapsible } from "@tuiparts/react/collapsible";
import { Input } from "@tuiparts/react/input";
import { NumberField } from "@tuiparts/react/number-field";
import { Radio } from "@tuiparts/react/radio";
import { RadioGroup } from "@tuiparts/react/radio-group";
import { Slider } from "@tuiparts/react/slider";
import { Switch } from "@tuiparts/react/switch";
import { Textarea } from "@tuiparts/react/textarea";
import { Dialog } from "@tuiparts/react/dialog";
import { Toggle } from "@tuiparts/react/toggle";
import { ToggleGroup } from "@tuiparts/react/toggle-group";
import { Tabs } from "@tuiparts/react/tabs";

Dialog

Dialog is the React compound adapter for the packaged Dialog behavior in @tuiparts/core/dialog. Compose its Root, Trigger, Portal, Backdrop, Popup, Title, Description, and Close parts, or install the editable react/dialog registry recipe for an opinionated visual assembly. The adapter preserves coordinator-owned visibility and z-index plus portal, focus, and controlled-state lifecycle behavior.

The existing @tuiparts/dialog/react provider, hooks, and async APIs remain the companion convenience surface; they are not re-exported by the React adapter.

Input

Input is an additive, unstyled adapter that preserves OpenTUI's mutable value and event model. It has no defaultValue, controlled rollback, or callback aliases.

import { Input } from "@tuiparts/react/input";

<Input
  value="initial"
  onInput={console.log}
  onChange={commit}
  onSubmit={submit}
/>;

onInput reports mutations, onChange reports commits on blur or submit, and onSubmit reports Enter after any changed-value onChange. Visual defaults belong in editable recipes. This is the canonical primitive contract.

Textarea

Textarea is the named single-part adapter for OpenTUI's multiline editor. It preserves initialValue, the native EditBuffer, editing methods, keybindings, and cursor/content/submit callbacks. Refs resolve to the actual Core TextareaRenderable; there is no controlled value facade or Store.

Recipes

Behaviorless presentation such as Badge is installed from the registry rather than imported from this package. Consumer-owned recipes use ordinary TypeScript and native OpenTUI properties.

License

MIT