Tutorials
HTML tutorial
The simplest possible start: copy semantic HTML with Lily's class hooks, add one stylesheet, ship. Plain files that work anywhere HTML works.
What you'll build
A small contact form — labelled inputs, a submit button, real keyboard and screen-reader behaviour — first bare, then styled, in about 10 minutes.
Before you start
You need a browser and a text editor. That's all. (git helps for grabbing the component files, but you can copy them from GitHub in the browser too.)
Step 1 — Get the code
git clone https://github.com/LilyDesignSystem/lily-design-system-html-headless
cd lily-design-system-html-headless Every component is a standalone file in components/ — button.html, text-input.html, and so on — with a
header comment documenting its HTML tag, class hook, keyboard behaviour,
and accessibility contract. The files are the library — copy
what you need and go.
Step 2 — Your first component
Open components/button.html, or just write the markup — the class hook is the contract:
<button class="button" type="button">
Save
</button> Because it's a real <button>, keyboard focus, Enter and
Space activation, and the implicit button role are already correct.
Step 3 — Compose a small form
<form class="form">
<div class="field">
<label class="label" for="name">Full name</label>
<input class="text-input" type="text" id="name" name="name" required />
</div>
<div class="field">
<label class="label" for="email">Email</label>
<input class="email-input" type="email" id="email" name="email" required />
</div>
<button class="button" type="submit">Save</button>
</form> Note the pattern: every control links its <label for>,
uses the most specific input type, and carries exactly one kebab-case
class hook.
Check your work: open the page in a browser. It looks plain — exactly as intended: styling is still ahead. Press Tab: focus moves through every control, the labels are announced, and submit works. The behaviour is done; the look is yours, and it's next.
Step 4 — Style it
Write CSS against the hooks:
.button {
background: #2563eb;
color: #fff;
padding: 0.75rem 1.5rem;
border: 0;
border-radius: 0.5rem;
}
.text-input,
.email-input {
padding: 0.5rem 0.75rem;
border: 2px solid #6b7280;
border-radius: 0.25rem;
}
.label { display: block; font-weight: 600; margin-bottom: 0.25rem; } Or skip hand-writing CSS entirely — link one of the 45 ready-made themes and the same markup lights up:
<link rel="stylesheet" href="/themes/united-kingdom-national-health-service-england-for-patients.css" /> Step 5 — Explore further
- The repo's tests run real browsers:
pnpm install && pnpm test(WebDriverIO). - Storybook for every component:
pnpm run storybook. - The HTML+CSS+JS example app shows all 490 components styled, searchable, and demoed.
Next steps
- Theming — runtime theme switching with theme-select.
- Preference helpers — language and text size.
- Component catalog — the full reference.
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.