Menhir

Getting started

Menhir is a set of unstyled, accessible UI primitives for SolidJS 2.0, written the Solid 2.0 way. Each component is its own entry point, so an app ships only what it imports.

Status

Early 0.x versions: the API may change between minor versions. The simple components are built; Dialog, Popover and the other popups come next.

Install

pnpm add menhir

Menhir needs Solid 2.0. If your app does not have it yet:

pnpm add solid-js @solidjs/web

Your first component

Import a component from its entry point and compose its parts. Here a Switch is labelled by the <label> around it:

import { Switch } from "menhir/switch";

export function AirplaneMode() {
  return (
    <label>
      <Switch.Root name="airplane-mode" class="switch">
        <Switch.Thumb class="thumb" />
      </Switch.Root>
      Airplane mode
    </label>
  );
}

Nothing is styled. Every part exposes its state as data attributes, such as data-checked, for your CSS to select:

.switch[data-checked] {
  background: steelblue;
}
.thumb[data-checked] {
  transform: translateX(1.25rem);
}

Styling with a coding agent

Menhir ships a skill for coding agents that styles its components in one consistent look, such as the shadcn look. Point your agent at it with a line in your project's AGENTS.md: "To style Menhir components, follow node_modules/menhir/skills/menhir-styling/SKILL.md". Styling has the rest: the looks, what to ask for, and a look of your own.

Next

See all components, with each one's parts, props, keyboard behaviour and size, or compare every entry point's bundle size.