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

@vanelsas/baredom-react

v2.1.0

Published

React 19 wrapper components for BareDOM — auto-generated from component metadata.

Downloads

53

Readme

@vanelsas/baredom-react

React 19 wrapper components for BareDOM — auto-generated from component metadata.

Provides typed props, event handlers, and ref forwarding for all 90+ BareDOM web components.

Installation

npm install @vanelsas/baredom-react @vanelsas/baredom react

Usage

import { XButton } from "@vanelsas/baredom-react/x-button";
import { XAlert } from "@vanelsas/baredom-react/x-alert";
import { XTheme } from "@vanelsas/baredom-react/x-theme";

function App() {
  return (
    <XTheme>
      <XButton
        disabled={false}
        onPress={(e) => console.log("Pressed!", e.detail.source)}
      >
        Click me
      </XButton>

      <XAlert
        type="success"
        text="Operation completed"
        dismissible
        onDismiss={() => console.log("Dismissed")}
      />
    </XTheme>
  );
}

Features

  • Typed props — all component properties are typed in the props interface
  • Event handlers — custom events mapped to onEventName props (e.g. onPress, onDismiss, onChange)
  • Ref forwardingforwardRef with typed element refs for accessing methods
  • Next.js compatible — every wrapper includes "use client" directive
  • Tree-shakable — import individual components to keep bundle size small

Event naming

BareDOM event names are automatically converted to React-style callback props:

| DOM event | React prop | |-----------|-----------| | press | onPress | | x-alert-dismiss | onDismiss | | x-switch-change | onChange | | value-change | onValueChange | | hover-start | onHoverStart |

The component's tag-name prefix (e.g. x-alert-) is stripped, and the remainder is camelCased with an on prefix.

Controlled inputs

Input components support React's controlled component pattern. When you pass a value (or checked) prop, the wrapper prevents the component from updating its own state — React becomes the source of truth.

import { useState } from "react";
import { XCheckbox } from "@vanelsas/baredom-react/x-checkbox";
import { XSlider } from "@vanelsas/baredom-react/x-slider";

function Form() {
  const [checked, setChecked] = useState(false);
  const [volume, setVolume] = useState("50");

  return (
    <>
      {/* Controlled: React owns the state */}
      <XCheckbox
        checked={checked}
        onChangeRequest={(e) => setChecked(e.detail.nextChecked)}
      />

      <XSlider
        value={volume}
        min="0" max="100"
        onChangeRequest={(e) => setVolume(String(e.detail.value))}
      />

      {/* Uncontrolled: component manages itself */}
      <XCheckbox
        defaultChecked={true}
        onChange={(e) => console.log(e.detail.checked)}
      />
    </>
  );
}

Controlled components: XCheckbox, XSwitch, XRadio (checked), XSlider, XTextArea, XSelect, XCombobox, XCurrencyField, XTabs (value), XPagination (page).

| Mode | Prop | Behavior | |------|------|----------| | Controlled | checked / value / page | Component state blocked, React owns updates via onChangeRequest | | Uncontrolled | defaultChecked / defaultValue / defaultPage | Sets initial value, component manages itself afterwards | | Uncontrolled | (neither) | Component manages itself from default |

Refs and methods

Access the underlying DOM element and its methods via ref:

import { useRef } from "react";
import { XModal } from "@vanelsas/baredom-react/x-modal";
import type { XModal as XModalElement } from "@vanelsas/baredom/x-modal";

function Dialog() {
  const ref = useRef<XModalElement>(null);

  return (
    <>
      <button onClick={() => ref.current?.show()}>Open</button>
      <XModal ref={ref} onToggle={(e) => console.log(e.detail)}>
        Modal content
      </XModal>
    </>
  );
}

Theming

Wrap your app with <XTheme> to enable BareDOM's design tokens. Components automatically adapt to system dark/light mode.

import { XTheme } from "@vanelsas/baredom-react/x-theme";

function App() {
  return (
    <XTheme preset="aurora">
      {/* All BareDOM components inherit theme tokens */}
    </XTheme>
  );
}

Custom presets

Use the useRegisterPreset hook to register a custom theme preset. Any tokens you omit fall back to the default BareDOM preset.

import { useRegisterPreset } from "@vanelsas/baredom-react/hooks";
import { XTheme } from "@vanelsas/baredom-react/x-theme";

const brandTokens = {
  light: {
    "--x-color-primary": "#e11d48",
    "--x-color-primary-hover": "#be123c",
    "--x-font-family": "'Inter', sans-serif",
  },
  dark: {
    "--x-color-primary": "#fb7185",
    "--x-color-primary-hover": "#f43f5e",
  },
};

function App() {
  useRegisterPreset("brand", brandTokens);
  return (
    <XTheme preset="brand">
      {/* Components use your brand tokens */}
    </XTheme>
  );
}

Requirements

  • React 19+
  • @vanelsas/baredom 2.6.0+

Auto-generated

The wrapper components are auto-generated from BareDOM's component model metadata using bb scripts/generate_react.bb. Adding a new component to BareDOM automatically produces its React wrapper.

License

MIT