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

@md-expressive/react

v0.0.3

Published

React components for @md-expressive/web-components (Material 3 Expressive).

Readme

@md-expressive/react

React components for @md-expressive/web-components, Material 3 Expressive components modelled on Jetpack Compose. Works with React 18 and 19.

npm install @md-expressive/react
import { useState } from 'react';
import { Button, Icon, Switch, applyTheme } from '@md-expressive/react';

applyTheme('#6750A4'); // generates the colour scheme on <html>

export function Settings() {
  const [wifi, setWifi] = useState(true);
  return (
    <>
      <Switch checked={wifi} onMdChange={(e) => setWifi(e.detail.checked)} />
      <Button variant="tonal" onClick={() => setWifi(false)}>
        <Icon slot="icon">wifi_off</Icon>Turn off
      </Button>
    </>
  );
}

Each element has a component named after its tag, without the md- (<md-text-field> is TextField). Each one registers its custom element the first time it renders, so your bundle only contains the components you import. The theming, font and motion utilities and every type are re-exported, so you only need this package.

Props and events

  • Props are set as element properties, so objects, arrays and functions work (isDateSelectable={(date) => …} on DatePicker). Their names are the camel-case property names from the web components' docs (supportingText, not supporting-text).
  • Component events are on + the event name: mdChange is onMdChange, mdSelect is onMdSelect. The handler gets the CustomEvent, with its data in e.detail.
  • Native events: onClick and onInput work on every React version. Prefer onMdChange to onChange: React 18 doesn't deliver change events from custom elements. In controlled mode (below), use onMdChange / onMdInput.
  • Slots are the slot attribute on a child, as in HTML: <Icon slot="icon">.
  • Methods (show(), close(), …) are on the element; use a ref.

Controlled components

Pass a component's value prop and it's controlled, exactly like React's native inputs: it only ever shows your state. Each change the user makes is proposed to your handler, with the new value in e.detail; set the state to accept it, set something else to replace it, or do nothing to refuse it.

const [name, setName] = useState('');
<TextField label="Code" value={name} onMdInput={(e) => setName(e.detail.value.toUpperCase())} />

const [volume, setVolume] = useState(20);
<Slider value={volume} onMdInput={(e) => setVolume(Math.min(50, e.detail.value))} />

| Component | Value prop | Handler | |---|---|---| | Switch, Checkbox, Radio | checked | onMdChange | | Button, IconButton (toggles), Chip (filter), ListItem, MenuItem | selected | onMdChange | | Tabs | selectedIndex | onMdChange | | NavigationBar, NavigationRail | value | onMdChange | | DatePicker | value, or start / end | onMdChange | | DockedDatePicker, DateField | value | onMdChange | | Slider, ScrollField, TextField, TimePicker | value | onMdInput | | RangeSlider | valueStart, valueEnd | onMdInput |

Controlled components still feel native: a dragged thumb stays under the pointer, typed text keeps its caret, and a refused switch springs back. Your update is applied during the event (as React does for its own inputs), so fast typing and key repeats never work from a stale value.

Leave the value prop out and the component keeps its own state (uncontrolled); handlers then just report changes.

Server rendering

The components are client components (the module starts with 'use client'), so they work in Next.js and other server-rendering frameworks, but they draw on the client: the server's HTML doesn't contain their shadow DOM yet.