Solid tutorial

Lily's catalog as Solid 2.0 components: pass a signal's value in, get the new value back from onChange, and Solid updates only what changed.

What you'll build

A small contact form — a labelled input, a submit button, state in a signal, real keyboard and screen-reader behaviour — first bare, then styled, in about 10 minutes.

Before you start

You need Node 22 or later and a Solid 2.0 project built with Vite and vite-plugin-solid. The package's peer dependencies are solid-js and @solidjs/web, both 2.0.

Step 1 — Install

npm install @lilydesignsystem/solid-headless @lilydesignsystem/themes

One package holds the 473 core components, each a named export. The national identifiers (health, tax and identity numbers) are an add-on, @lilydesignsystem/solid-headless-identifiers.

Step 2 — Your first component

import { Button } from "@lilydesignsystem/solid-headless";

export function SaveBar() {
  return <Button onClick={save}>Save</Button>;
}

Renders <button class="button" type="button">. Props: type, disabled, pressed (renders aria-pressed), label (an aria-label override), class, and any extra attribute spreads onto the root element. Solid writes class, not React's className.

Step 3 — Compose a small form

import { createSignal } from "solid-js";
import { Form, Field, TextInput, Button } from "@lilydesignsystem/solid-headless";

export function ContactForm() {
  const [name, setName] = createSignal("");
  return (
    <Form label="Contact form" onSubmit={() => save(name())}>
      <Field label="Full name" inputId="name" required>
        <TextInput id="name" label="Full name" value={name()} onChange={setName} required />
      </Field>
      <Button type="submit">Save</Button>
    </Form>
  );
}

Field renders the visible label and points it at the input through inputId; TextInput's own label is its accessible name. Form prevents the browser's default submit before it calls onSubmit.

Verified 2026-11-19: this form was rendered with the package's own test setup: the label labels the input, typing updates the signal, and submitting calls the handler with the typed value.

Step 4 — The Solid idioms

  • Pass the value, not the signal. Write value={name()}. Solid's compiler wraps it, so the input follows the signal.
  • onChange gets the value. A text input gives the new string, a checkbox (CheckboxInput) the new boolean, so a setter fits directly: onChange={setName}.
  • Don't destructure props in your own wrappers around Lily components: in Solid, destructuring reads a prop once and stops following it. Read props.name where you use it, and take the rest with omit from solid-js (Solid 2.0's replacement for splitProps), as the components themselves do.
  • Form reset works. Every bound input also sets its default value, so a <button type="reset"> puts it back.

Step 5 — Style it

Everything above renders as pure structure, ready for your styles. Style the hooks — .button, .text-input, .field, .form — in your stylesheet, or import a ready-made theme once, in your entry file:

import "@lilydesignsystem/themes/light.css";

Step 6 — See it all working

The Solid example app is the full catalog styled and demoed, on Solid Router 2.0:

git clone https://github.com/LilyDesignSystem/lily-design-system
cd lily-design-system/lily-design-system-solid-examples
pnpm install && pnpm run dev

Next steps

Questions along the way? The help page is full of answers — and if a step could be clearer, tell us and we'll gladly improve the tutorial.