Recipes
Small copy-paste compositions of catalog components, between one component and a whole page. Replace the
placeholder words with your own.
Card: the whole card as one link
Uses card, button. Tags: card, navigation, link. Source.
<!-- One link, in the heading, carries data-lily-card-link: the theme's shared "Whole-card link" section stretches
its target over the card and draws the focus ring round the card. The link's text is the card's name, so a
screen reader hears one link, not the whole card read as a link. Anything else interactive inside the card,
such as the button here, stays above the link and keeps its own target. In a framework catalog, card's own heading does the
same with href and wholeCardLink. -->
<div class="card">
<h3>
<a
href="/appointments/2026-11-24"
data-lily-card-link
>Physiotherapy, 24 November</a
>
</h3>
<p>10:30 at Riverside Health Centre, with Sam Okoro.</p>
<button
class="button"
type="button"
>
Add to calendar
</button>
</div>
Checkbox group: select all that apply
Uses checkbox-group, checkbox-input, label, hint. Tags: form, choice. Source.
<fieldset
class="checkbox-group"
aria-describedby="allergies-hint"
>
<legend>Do you have any of these allergies?</legend>
<p
class="hint"
id="allergies-hint"
>
Select all that apply.
</p>
<input
class="checkbox-input"
type="checkbox"
id="allergy-nuts"
name="allergies"
value="nuts"
/>
<label
class="label"
for="allergy-nuts"
>Nuts</label
>
<input
class="checkbox-input"
type="checkbox"
id="allergy-penicillin"
name="allergies"
value="penicillin"
/>
<label
class="label"
for="allergy-penicillin"
>Penicillin</label
>
<input
class="checkbox-input"
type="checkbox"
id="allergy-latex"
name="allergies"
value="latex"
/>
<label
class="label"
for="allergy-latex"
>Latex</label
>
</fieldset>
Field: browser autocomplete
Uses field, label, text-input. Tags: form, autocomplete. Source.
<!-- The autocomplete tokens let the browser fill known details (WCAG 1.3.5, Identify Input Purpose). -->
<div class="field">
<label
class="label"
for="given-name"
>Given name</label
>
<input
class="text-input"
type="text"
id="given-name"
name="given-name"
autocomplete="given-name"
/>
</div>
<div class="field">
<label
class="label"
for="family-name"
>Family name</label
>
<input
class="text-input"
type="text"
id="family-name"
name="family-name"
autocomplete="family-name"
/>
</div>
Field: checkbox
Uses field, checkbox-input, label. Tags: form, consent. Source.
<div class="field">
<input
class="checkbox-input"
type="checkbox"
id="updates"
name="updates"
value="yes"
/>
<label
class="label"
for="updates"
>Send me updates about my appointment</label
>
</div>
Field: combobox
Uses field, label, combobox, hint. Tags: form, search. Source.
<div class="field">
<label
class="label"
for="medicine"
>Medicine</label
>
<p
class="hint"
id="medicine-hint"
>
Start typing, then choose from the list.
</p>
<div class="combobox">
<input
id="medicine"
type="text"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="medicine-list"
aria-describedby="medicine-hint"
/>
<div
id="medicine-list"
role="listbox"
aria-label="Medicines"
popover="manual"
>
<div
role="option"
id="medicine-1"
data-value="amoxicillin"
>
Amoxicillin
</div>
<div
role="option"
id="medicine-2"
data-value="atorvastatin"
>
Atorvastatin
</div>
</div>
</div>
</div>
Field: disabled
Uses field, label, text-input, hint. Tags: form, disabled. Source.
<div class="field">
<label
class="label"
for="member-number"
>Membership number</label
>
<p
class="hint"
id="member-number-hint"
>
Your number cannot be changed. Contact us if it is wrong.
</p>
<input
class="text-input"
type="text"
id="member-number"
name="member-number"
value="M-204781"
disabled
aria-describedby="member-number-hint"
/>
</div>
Uses field, label, input-group, number-input, hint. Tags: form, currency. Source.
<div class="field">
<label
class="label"
id="amount-label"
for="amount"
>Amount</label
>
<p
class="hint"
id="amount-hint"
>
In euros, to the nearest cent.
</p>
<div
class="input-group"
role="group"
aria-labelledby="amount-label"
>
<span aria-hidden="true">€</span>
<input
class="number-input"
type="number"
id="amount"
name="amount"
min="0"
step="0.01"
inputmode="decimal"
aria-describedby="amount-hint"
/>
</div>
</div>
Field: number
Uses field, label, number-input, hint. Tags: form, number. Source.
<div class="field">
<label
class="label"
for="people"
>Number of people</label
>
<p
class="hint"
id="people-hint"
>
Up to 8.
</p>
<input
class="number-input"
type="number"
id="people"
name="people"
min="1"
max="8"
step="1"
inputmode="numeric"
aria-describedby="people-hint"
/>
</div>
Field: required
Uses field, label, text-input, hint. Tags: form, required. Source.
<div
class="field"
data-required="true"
>
<label
class="label"
for="full-name"
>Full name</label
>
<p
class="hint"
id="full-name-hint"
>
As it appears on your passport.
</p>
<input
class="text-input"
type="text"
id="full-name"
name="full-name"
autocomplete="name"
required
aria-describedby="full-name-hint"
/>
</div>
Field: select
Uses field, label, select. Tags: form, choice. Source.
<div class="field">
<label
class="label"
for="contact-method"
>How should we contact you?</label
>
<select
class="select"
id="contact-method"
name="contact-method"
>
<option value="">Choose one</option>
<option value="email">Email</option>
<option value="phone">Phone</option>
<option value="post">Post</option>
</select>
</div>
Field: slider
Uses field, label, range-input, hint. Tags: form, range. Source.
<div class="field">
<label
class="label"
for="pain-score"
>Pain score</label
>
<p
class="hint"
id="pain-score-hint"
>
0 is no pain, 10 is the worst pain you can imagine.
</p>
<input
class="range-input"
type="range"
id="pain-score"
name="pain-score"
min="0"
max="10"
step="1"
value="0"
aria-describedby="pain-score-hint"
/>
</div>
Field: switch
Uses field, label, switch-button, hint. Tags: form, setting. Source.
<!-- A switch acts at once; inside a form that submits later, use checkbox instead. -->
<div class="field">
<span
class="label"
id="reminders-label"
>Text message reminders</span
>
<p
class="hint"
id="reminders-hint"
>
We text you the day before.
</p>
<button
class="switch-button"
type="button"
role="switch"
aria-checked="false"
aria-labelledby="reminders-label"
aria-describedby="reminders-hint"
></button>
</div>
Field: text area
Uses field, label, text-area-input, hint. Tags: form, text. Source.
<div class="field">
<label
class="label"
for="symptoms"
>Describe your symptoms</label
>
<p
class="hint"
id="symptoms-hint"
>
Include when they started and anything that makes them better or worse.
</p>
<textarea
class="text-area-input"
id="symptoms"
name="symptoms"
rows="5"
aria-describedby="symptoms-hint"
></textarea>
</div>
Field: with an error
Uses field, label, text-input, hint, error-message. Tags: form, validation. Source.
<div
class="field"
data-invalid="true"
>
<label
class="label"
for="email"
>Email address</label
>
<p
class="hint"
id="email-hint"
>
We will only use this to send your receipt.
</p>
<p
class="error-message"
id="email-error"
>
Enter an email address in the correct format, like name@example.com
</p>
<input
class="text-input"
type="email"
id="email"
name="email"
autocomplete="email"
value="name.example.com"
aria-invalid="true"
aria-describedby="email-hint email-error"
aria-errormessage="email-error"
/>
</div>
Field: native validity
Uses field, label, text-input, hint, error-message. Tags: form, validation. Source.
<!-- The browser checks the pattern; a theme styles :user-invalid, which matches only after the user has edited and left
the field. On submit, script shows the error message in the consumer's words and adds its id to aria-describedby:
a hidden element named in aria-describedby is still read out, so it is linked only once it is shown. -->
<div
class="field"
data-required="true"
>
<label
class="label"
for="postcode"
>Postcode</label
>
<p
class="hint"
id="postcode-hint"
>
For example, LS1 4AP.
</p>
<p
class="error-message"
id="postcode-error"
hidden
>
Enter a real postcode
</p>
<input
class="text-input"
type="text"
id="postcode"
name="postcode"
autocomplete="postal-code"
required
pattern="[A-Za-z0-9 ]{5,8}"
aria-describedby="postcode-hint"
/>
</div>
Uses form, error-summary, field, label, text-input, error-message, radio-group, radio-input, button. Tags: form, validation. Source.
<!-- On submit with errors: show the summary, link each item to its field, and move focus to the summary. -->
<form
class="form"
novalidate
aria-labelledby="booking-title"
>
<h2 id="booking-title">Book an appointment</h2>
<div
class="error-summary"
role="alert"
aria-labelledby="booking-errors"
tabindex="-1"
>
<h2 id="booking-errors">There is a problem</h2>
<ul>
<li><a href="#booking-name">Enter your full name</a></li>
</ul>
</div>
<div
class="field"
data-required="true"
data-invalid="true"
>
<label
class="label"
for="booking-name"
>Full name</label
>
<p
class="error-message"
id="booking-name-error"
>
Enter your full name
</p>
<input
class="text-input"
type="text"
id="booking-name"
name="name"
autocomplete="name"
required
aria-invalid="true"
aria-describedby="booking-name-error"
aria-errormessage="booking-name-error"
/>
</div>
<fieldset
class="radio-group"
role="radiogroup"
aria-labelledby="booking-time-legend"
>
<legend id="booking-time-legend">Preferred time</legend>
<input
class="radio-input"
type="radio"
id="booking-morning"
name="time"
value="morning"
/>
<label
class="label"
for="booking-morning"
>Morning</label
>
<input
class="radio-input"
type="radio"
id="booking-afternoon"
name="time"
value="afternoon"
/>
<label
class="label"
for="booking-afternoon"
>Afternoon</label
>
</fieldset>
<button
class="button"
type="submit"
>
Book appointment
</button>
</form>
Radio group: one choice
Uses radio-group, radio-input, label. Tags: form, choice. Source.
<fieldset
class="radio-group"
role="radiogroup"
aria-labelledby="visit-legend"
>
<legend id="visit-legend">How would you like your appointment?</legend>
<input
class="radio-input"
type="radio"
id="visit-in-person"
name="visit"
value="in-person"
/>
<label
class="label"
for="visit-in-person"
>In person</label
>
<input
class="radio-input"
type="radio"
id="visit-phone"
name="visit"
value="phone"
/>
<label
class="label"
for="visit-phone"
>By phone</label
>
<input
class="radio-input"
type="radio"
id="visit-video"
name="visit"
value="video"
/>
<label
class="label"
for="visit-video"
>By video</label
>
</fieldset>