Frontend development · Beginner · 22 min
Build the Larkfield button in HTML and CSS
By Padding · Updated 18 Nov 2026
Modern browsers · HTML Living Standard and WAI-ARIA 1.2 · checked in Chromium with Playwright 1.65.1
You will build the Larkfield Clinic button as a real button element with primary, secondary and destructive variants drawn from colour tokens, hover, pressed, keyboard focus, disabled and loading states, a 48 pixel minimum height, and a Playwright script that checks every state's computed styles.
On this page
The button is the first component worth building from a design system, because every screen needs one and every mistake in it is repeated everywhere. Larkfield Clinic, the fictional community clinic whose appointment booking app runs through this library, already has its button designed: an accent fill, white label text, an 8 pixel corner radius and a 48 pixel height, with a secondary version that has a white fill and a grey border. The button sheet from Design buttons: hierarchy, sizes and every state decided what the set should be, down to the colour of every state. This tutorial turns that sheet into code that behaves.
You will write one stylesheet that gives three variants (primary, secondary and destructive) and six states (rest, hover, pressed, keyboard focus, disabled and loading). The variants only set colours; the states read them. That split keeps the CSS short, and it means a new variant later is four lines. You finish with a component page, the kind a team keeps open while building screens, and a Playwright script that loads that page in Chromium and checks the computed style of each state, so a later change that breaks one is caught.
Everything here is plain HTML, CSS and a few lines of JavaScript. No framework, no build step, no web font download.
Step 1 · Write the colour tokens
Make a folder for the demo and a tokens.css file. The values are the Larkfield colour variables as the button sheet uses them, after Build a colour palette with tonal ramps moved each one onto a ramp step. They are written as CSS custom properties with the same names, so a designer and a developer can talk about colour/accent and --colour-accent as one thing:
mkdir -p ~/larkfield-button-demo
cd ~/larkfield-button-demo
cat > tokens.css <<'CSS'
:root {
/* Larkfield semantic colour variables */
--colour-text: #20242a; /* grey/900 */
--colour-text-muted: #656970; /* grey/600 */
--colour-surface: #ffffff; /* grey/0 */
--colour-canvas: #f3f5f8; /* grey/50 */
--colour-line: #cfd5dc; /* grey/200 */
--colour-border: #7f848b; /* grey/500 */
--colour-accent: #0f5e5a; /* teal/700 */
--colour-accent-tint: #ebf8f7; /* teal/50 */
--colour-on-accent: #ffffff; /* grey/0 */
--colour-danger: #b42318; /* red/600 */
/* State variables from the button sheet */
--colour-accent-hover: #014441; /* teal/800 */
--colour-accent-pressed: #002b29; /* teal/900 */
--colour-danger-hover: #9d0900; /* red/700 */
--colour-danger-pressed: #720500; /* red/800 */
--colour-focus: var(--colour-accent);
/* Ramp steps the sheet uses directly */
--teal-100: #d6eeeb;
--grey-100: #e3e8f0;
}
CSSNone of these is new to the design file. The state variables are the five the button sheet set up in the Larkfield collection: hover and pressed are one and two ramp steps darker than the fill they belong to, so white labels get more contrast as the button darkens (7.58:1 on the accent at rest, 11.03:1 on hover, 15.24:1 pressed; 6.57:1, 8.49:1 and 12.09:1 on the red). --colour-focus is an alias of the accent, written as var() so it follows the accent if that ever changes. Two cells of the sheet point straight at ramp steps instead of semantic variables, the secondary pressed fill (teal/100) and the disabled fill (grey/100), so those two primitives come across under their ramp names. The comments name the ramp step behind each value, so the file can be checked against the design without opening it.
If your design file still has the pre-ramp values from the high-fidelity tutorial, such as colour/border at #7D8592, use the values in your file: the CSS below only reads the names.
Check it worked
Run cat tokens.css in the folder. You see seventeen custom properties inside one :root block: ten semantic colours, five state variables and two ramp steps, and every hex value has its ramp step in a comment.
Step 2 · Put real buttons on a component page
A button in HTML is the button element. It is focusable with the Tab key, it fires a click on Enter and Space, and screen readers announce it as a button, all without extra code. A div or a link styled to look like a button gets none of that. Write the component page with one section per thing you want to see:
cd ~/larkfield-button-demo
cat > index.html <<'HTML'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Larkfield buttons</title>
<link rel="stylesheet" href="tokens.css">
<link rel="stylesheet" href="button.css">
<style>
body { margin: 0; padding: 1rem; background: var(--colour-canvas); color: var(--colour-text); font-family: system-ui, sans-serif; line-height: 1.5; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.hint { margin: 0; font-size: 0.875rem; color: var(--colour-text-muted); }
</style>
<script src="button.js" defer></script>
<script src="demo.js" defer></script>
</head>
<body>
<main>
<h1>Larkfield buttons</h1>
<h2>Variants</h2>
<div class="row">
<button type="button" class="button button--primary" id="book">Book appointment</button>
<button type="button" class="button button--secondary" id="change">Change time</button>
<button type="button" class="button button--destructive" id="cancel">Cancel booking</button>
</div>
<p class="hint" id="status" role="status"></p>
<h2>Disabled, with a reason</h2>
<div class="stack">
<button type="button" class="button button--primary" id="next-week" aria-disabled="true" aria-describedby="next-week-why">See next week</button>
<p class="hint" id="next-week-why">Bookings open four weeks ahead. More times from Monday.</p>
</div>
<h2>Long label</h2>
<button type="button" class="button button--primary" id="long">Book a nurse appointment for Tuesday 9 December at 10:30</button>
<p id="log">No button clicked yet.</p>
</main>
</body>
</html>
HTML
cat > demo.js <<'JS'
const log = document.getElementById('log');
let clicks = 0;
for (const button of document.querySelectorAll('.button')) {
button.addEventListener('click', () => {
clicks += 1;
log.textContent = `Clicked ${button.textContent.trim()} (${clicks} so far)`;
});
}
JSEvery button has type="button". Without it, a button inside a form defaults to type="submit" and sends the form, which is a classic source of bookings made by accident. The labels start with a verb and say what happens: "Book appointment", not "OK". The page links button.css and button.js, which you write in the next steps; until then the browser shows its default buttons. demo.js only belongs to this page: it writes which button was clicked into the line at the bottom, so you can see when a click gets through. The empty status paragraph under the variants is for the loading step.
Check it worked
Open index.html in a browser (open index.html on macOS, xdg-open index.html on Linux, or drag the file into a browser window). You see five plain grey browser buttons. Press Tab: focus moves through them in order, and pressing Enter on "Change time" changes the bottom line to "Clicked Change time (1 so far)". Your buttons work before a line of CSS exists.
Step 3 · Style the base button and the three variants
Now button.css. The .button rule sets everything the variants share: shape, size, type and layout. It reads its colours from four custom properties, --bg, --fg, --edge and the state colours, and each variant class only fills those in:
cd ~/larkfield-button-demo
cat > button.css <<'CSS'
.button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
box-sizing: border-box;
min-height: 3rem;
max-width: 100%;
padding: 0.75rem 1.5rem;
border: 1px solid var(--edge);
border-radius: 0.5rem;
background-color: var(--bg);
color: var(--fg);
font: 600 0.875rem/1.25rem Inter, system-ui, sans-serif;
text-align: center;
cursor: pointer;
}
.button--primary {
--bg: var(--colour-accent);
--bg-hover: var(--colour-accent-hover);
--bg-pressed: var(--colour-accent-pressed);
--fg: var(--colour-on-accent);
--edge: transparent;
}
.button--secondary {
--bg: var(--colour-surface);
--bg-hover: var(--colour-accent-tint);
--bg-pressed: var(--teal-100);
--fg: var(--colour-accent);
--edge: var(--colour-border);
}
.button--destructive {
--bg: var(--colour-danger);
--bg-hover: var(--colour-danger-hover);
--bg-pressed: var(--colour-danger-pressed);
--fg: var(--colour-on-accent);
--edge: transparent;
}
CSSA few choices are worth knowing about:
min-height: 3remandpadding: 0.75rem 1.5remare the Large size from the sheet, 48 pixels tall with 24 pixels at each side, at the default text size. The height is written as a minimum. A label that wraps to two lines makes the button taller instead of spilling out of it, and a reader who sets a larger text size gets a larger button.- The primary and destructive buttons have a transparent 1 pixel border. The fill shows through it, so all three variants are the same size. It also gives the button an outline in forced colours modes such as Windows Contrast themes, which replace background and border colours with the system's own, so a transparent border becomes a visible one.
- Buttons do not inherit the page font, so
fontis set here: Larkfield'sLabeltext style, Semi Bold 14 on a 20 line height. Inter is listed first so it is used where it is installed, and the system font takes over elsewhere. No font file is downloaded, which matters on prepaid mobile data. max-width: 100%with normal wrapping lets a long label break onto a second line. Translated labels are often longer than English ones, in French, Yoruba or Swahili alike, and wrapping is better than cutting a label off with an ellipsis.
Check it worked
Reload the page. "Book appointment" is dark teal with white text, "Change time" is white with a grey border and teal text, and "Cancel booking" is red with white text. All three are the same height. Narrow the window to phone width: the long label wraps onto two lines inside a taller button, and the page does not scroll sideways.
Step 4 · Add hover and pressed states
States go after the variants, and each one swaps the background for the variant's own state colour:
cd ~/larkfield-button-demo
cat >> button.css <<'CSS'
@media (hover: hover) {
.button:hover { background-color: var(--bg-hover); }
}
.button:active { background-color: var(--bg-pressed); }
CSSBecause the variants already set --bg-hover and --bg-pressed, two rules cover all three variants. The hover rule sits inside @media (hover: hover), which only matches devices with a pointer that can hover, such as a mouse. On many Android phones a tap leaves the hover style stuck on a button until you tap somewhere else, which makes it look still selected; the media query avoids that.
There is no transition on the colour change. A short fade is fine to add, but a button that answers at once feels quicker on a slow phone, and it keeps the checking script simple.
Check it worked
Move the mouse over each button: the teal and red fills darken, and the white secondary button turns a very pale teal. Hold the mouse button down on one: it goes a step darker again while held (a slightly stronger teal tint on the secondary), and returns when you let go.
Step 5 · Show keyboard focus with focus-visible
Keyboard users need to see which button has focus. :focus-visible matches when the browser decides a focus ring should show, which in practice means focus arrived from the keyboard, not from a mouse click:
cd ~/larkfield-button-demo
cat >> button.css <<'CSS'
.button:focus-visible {
outline: 2px solid var(--colour-focus);
outline-offset: 2px;
}
CSSThis is the sheet's focus state: a 2 pixel ring in --colour-focus, drawn 2 pixels outside the button's edge. The gap is what keeps a teal ring visible around a teal button, and the ring itself measures 7.58:1 on white and 6.94:1 on the canvas. An outline does not take up layout space, so the buttons around it do not move when it appears. Never remove the browser's ring with outline: none unless you replace it like this.
Check it worked
Click the page background, then press Tab. "Book appointment" gets a teal ring with a small gap around it, and the ring moves as you keep pressing Tab. Now click "Change time" with the mouse: it is focused, but no ring appears.
Step 6 · Disable a button and say why
The button sheet is strict about this state. Continue is never disabled to hide errors: the patient presses it and the form says what is missing. Disabled is allowed only where the action really cannot happen yet and the reason fits on one line beside it, and Larkfield has one such case. Bookings open four weeks ahead, so on Pick a time, in the No times this week state for the fourth week, the primary See next week button cannot work. It stays on screen, disabled, with "Bookings open four weeks ahead. More times from Monday." directly under it.
The obvious tool, the disabled attribute, removes the button from the Tab order, so a keyboard or screen reader user may never find it or the reason it is unavailable. Larkfield uses aria-disabled="true" instead: the button stays focusable and is announced as unavailable, and aria-describedby points at the reason, so it is read out with the button.
aria-disabled changes how the button is announced, not what it does, so a click still fires. A small script stops clicks on any button marked disabled or busy. It listens on the whole document in the capture phase, which runs before the button's own click listeners, so it covers every button on the page:
cd ~/larkfield-button-demo
cat > button.js <<'JS'
document.addEventListener('click', (event) => {
const button = event.target.closest('.button');
if (!button) return;
const disabled = button.getAttribute('aria-disabled') === 'true';
const busy = button.getAttribute('aria-busy') === 'true';
if (disabled || busy) {
event.preventDefault();
event.stopImmediatePropagation();
}
}, true);
JS
cat >> button.css <<'CSS'
.button:is(:disabled, [aria-disabled="true"]) {
background-color: var(--grey-100);
border-color: transparent;
color: var(--colour-text-muted);
cursor: not-allowed;
}
CSSThe disabled style comes last in the file and has the same specificity as :hover and :active, so it wins over both: a disabled button does not light up under the mouse. It also styles the native disabled attribute, for the cases where hiding a button from the Tab order is what you want. It matches the sheet: the same grey/100 fill for every variant, no visible stroke (the border is transparent, so the size does not change) and the label in --colour-text-muted. WCAG does not require contrast for inactive controls, but the label still measures 4.48:1 on grey/100, so it stays readable.
When the next week's bookings open, the screen's own code removes aria-disabled and the reason, and the button becomes a normal primary button again.
Check it worked
Reload. "See next week" is pale grey with grey text and no border, and "Bookings open four weeks ahead. More times from Monday." sits under it. Hover over it: nothing changes and the cursor shows a no-entry sign. Click it, or Tab to it and press Enter: Tab does reach it, and the bottom line does not change.
Step 7 · Add a loading state with aria-busy
After "Book appointment" is pressed, the booking takes a moment to reach the clinic. During that time the button should show it is working, refuse a second press (two presses can mean two bookings), and keep its label readable so nobody wonders what it was. Larkfield marks this with aria-busy="true", which the guard script in the last step already blocks, and draws a small spinner in CSS before the label:
cd ~/larkfield-button-demo
cat >> button.css <<'CSS'
.button[aria-busy="true"] {
background-color: var(--bg);
cursor: progress;
}
.button[aria-busy="true"]::before {
content: "";
flex: none;
width: 1em;
height: 1em;
border: 2px solid currentColor;
border-right-color: transparent;
border-radius: 50%;
animation: button-spin 0.8s linear infinite;
}
@keyframes button-spin {
to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
.button[aria-busy="true"]::before { animation-duration: 2.4s; }
}
CSS
cat >> demo.js <<'JS'
const book = document.getElementById('book');
const status = document.getElementById('status');
book.addEventListener('click', () => {
book.setAttribute('aria-busy', 'true');
status.textContent = 'Booking your appointment.';
// Stands in for the booking request; remove aria-busy when it finishes
setTimeout(() => {
book.removeAttribute('aria-busy');
status.textContent = 'Booked: Nurse appointment, Tuesday 9 December, 10:30.';
}, 2000);
});
JSThe busy button keeps its variant's rest colour and its white label: nothing fades or goes transparent. The spinner is drawn with currentColor, so it matches the label on any variant, and it is pure CSS, with no image to download. For readers who ask their system for less motion, it turns three times slower rather than stopping, so it still shows that something is happening.
aria-busy is mainly a hook for the CSS and the guard script. Screen reader support for it varies: most say nothing when a button becomes busy, and ARIA lets assistive technology hold back a busy element's content until it is no longer busy. So do not rely on it to tell anyone anything. What a screen reader user actually hears is the status message: the status paragraph has role="status", a polite live region, so "Booking your appointment." and then the result are read out when the text changes.
One deliberate difference from the sheet: its loading cell changes the label to "Booking". This build keeps "Book appointment", because a shorter label would shrink the button and move things around it, which the same cell forbids, and a changed button label is not reliably announced anyway. The status line carries the word instead. If your team wants the label change, fix the button's width before swapping the text.
Check it worked
Reload and click "Book appointment". A white spinner appears to the left of the label, which still reads "Book appointment", the line under the buttons says "Booking your appointment.", and the bottom line says "Clicked Book appointment (1 so far)". Click it again while it spins: the count does not go up. After two seconds the spinner goes, the status line changes to the booked appointment, and the next click counts as 2.
Step 8 · Check every state with a Playwright script
Looking at the page by eye works once. A script that checks the computed styles keeps working after someone edits a token or reorders the CSS. Install Playwright in the demo folder, with the Chromium browser it drives. On Linux, --with-deps also installs the system libraries Chromium needs and asks for your password to do it:
cd ~/larkfield-button-demo
npm init -y > /dev/null
npm install --save-dev playwright@1.65.1
npx playwright install --with-deps chromiumThen write the script. It opens the component page in a headless Chromium, checks that each variant is a real button at least 48 pixels tall with 24 pixel side padding, hovers and presses each one and reads the background colour, tabs to a button and reads the focus ring, and checks the disabled, loading (including the status message) and long-label cases. Browsers report computed colours as rgb(), so the expected values are the token hex codes converted:
cd ~/larkfield-button-demo
cat > check-button.mjs <<'JS'
import { chromium } from 'playwright';
import assert from 'node:assert/strict';
const url = new URL('./index.html', import.meta.url).href;
const browser = await chromium.launch();
const open = async (width = 800) => {
const page = await browser.newPage({ viewport: { width, height: 900 } });
await page.goto(url);
return page;
};
const css = (page, sel, prop, pseudo = null) =>
page.$eval(sel, (el, [p, ps]) => getComputedStyle(el, ps).getPropertyValue(p), [prop, pseudo]);
const logText = (page) => page.textContent('#log');
const variants = [
{ name: 'primary', sel: '#book', rest: 'rgb(15, 94, 90)', hover: 'rgb(1, 68, 65)', pressed: 'rgb(0, 43, 41)', text: 'rgb(255, 255, 255)' },
{ name: 'secondary', sel: '#change', rest: 'rgb(255, 255, 255)', hover: 'rgb(235, 248, 247)', pressed: 'rgb(214, 238, 235)', text: 'rgb(15, 94, 90)' },
{ name: 'destructive', sel: '#cancel', rest: 'rgb(180, 35, 24)', hover: 'rgb(157, 9, 0)', pressed: 'rgb(114, 5, 0)', text: 'rgb(255, 255, 255)' },
];
// Rest, hover and pressed
let page = await open();
assert.ok(await page.evaluate(() => matchMedia('(hover: hover)').matches), 'browser reports a hovering pointer');
for (const v of variants) {
assert.equal(await page.$eval(v.sel, (el) => el.tagName), 'BUTTON', `${v.name} is a button element`);
assert.equal(await page.$eval(v.sel, (el) => el.type), 'button', `${v.name} has type=button`);
const height = await page.$eval(v.sel, (el) => el.getBoundingClientRect().height);
assert.ok(height >= 48, `${v.name} is at least 48px tall`);
assert.equal(await css(page, v.sel, 'padding-left'), '24px', `${v.name} side padding`);
assert.equal(await css(page, v.sel, 'background-color'), v.rest, `${v.name} rest`);
assert.equal(await css(page, v.sel, 'color'), v.text, `${v.name} label colour`);
await page.hover(v.sel);
assert.equal(await css(page, v.sel, 'background-color'), v.hover, `${v.name} hover`);
await page.mouse.down();
assert.equal(await css(page, v.sel, 'background-color'), v.pressed, `${v.name} pressed`);
await page.mouse.up();
console.log(`${v.name}: ${Math.round(height)}px tall, rest, hover and pressed ok`);
}
assert.equal(await css(page, '#change', 'border-top-color'), 'rgb(127, 132, 139)', 'secondary border');
await page.close();
// Focus ring from the keyboard, none from a mouse click
page = await open();
await page.keyboard.press('Tab');
assert.equal(await page.evaluate(() => document.activeElement.id), 'book', 'Tab reaches the first button');
assert.equal(await css(page, '#book', 'outline-style'), 'solid', 'keyboard focus shows a ring');
assert.equal(await css(page, '#book', 'outline-width'), '2px');
assert.equal(await css(page, '#book', 'outline-offset'), '2px');
assert.equal(await css(page, '#book', 'outline-color'), 'rgb(15, 94, 90)');
await page.click('#change');
assert.equal(await css(page, '#change', 'outline-style'), 'none', 'mouse focus shows no ring');
console.log('focus: ring on keyboard focus only ok');
await page.close();
// Disabled with a reason
page = await open();
assert.equal(await css(page, '#next-week', 'background-color'), 'rgb(227, 232, 240)', 'disabled fill');
assert.equal(await css(page, '#next-week', 'border-top-color'), 'rgba(0, 0, 0, 0)', 'disabled has no visible stroke');
assert.equal(await css(page, '#next-week', 'color'), 'rgb(101, 105, 112)', 'disabled label');
assert.equal(await css(page, '#next-week', 'cursor'), 'not-allowed');
await page.hover('#next-week', { force: true });
assert.equal(await css(page, '#next-week', 'background-color'), 'rgb(227, 232, 240)', 'disabled ignores hover');
const reason = await page.$eval('#next-week', (el) => document.getElementById(el.getAttribute('aria-describedby')).textContent);
assert.equal(reason, 'Bookings open four weeks ahead. More times from Monday.', 'disabled button points at its reason');
let tabs = 0;
while ((await page.evaluate(() => document.activeElement.id)) !== 'next-week' && tabs < 10) {
await page.keyboard.press('Tab');
tabs += 1;
}
assert.equal(await page.evaluate(() => document.activeElement.id), 'next-week', 'disabled button is reachable by Tab');
await page.keyboard.press('Enter');
await page.click('#next-week', { force: true });
assert.equal(await logText(page), 'No button clicked yet.', 'disabled button ignores Enter and clicks');
console.log('disabled: styled, explained, focusable and inert ok');
await page.close();
// Loading
page = await open();
await page.click('#book');
assert.equal(await page.getAttribute('#book', 'aria-busy'), 'true', 'button is busy after a click');
assert.equal(await page.textContent('#status'), 'Booking your appointment.', 'status message says what is happening');
assert.equal(await logText(page), 'Clicked Book appointment (1 so far)');
assert.equal(await css(page, '#book', 'color'), 'rgb(255, 255, 255)', 'busy label keeps its colour');
assert.equal(await css(page, '#book', 'opacity'), '1', 'busy label is not faded');
assert.equal((await page.textContent('#book')).trim(), 'Book appointment', 'busy label text is unchanged');
assert.equal(await css(page, '#book', 'content', '::before'), '""', 'spinner is drawn');
await page.click('#book', { force: true });
assert.equal(await logText(page), 'Clicked Book appointment (1 so far)', 'second click while busy is ignored');
await page.waitForFunction(() => !document.getElementById('book').hasAttribute('aria-busy'), null, { timeout: 5000 });
assert.equal(await css(page, '#book', 'content', '::before'), 'none', 'spinner goes when done');
assert.equal(await page.textContent('#status'), 'Booked: Nurse appointment, Tuesday 9 December, 10:30.', 'status message gives the result');
await page.click('#book');
assert.equal(await logText(page), 'Clicked Book appointment (2 so far)', 'button works again');
console.log('loading: busy, readable and blocks repeat clicks ok');
await page.close();
// Long label on a small phone
page = await open(320);
const long = await page.$eval('#long', (el) => el.getBoundingClientRect());
assert.ok(long.height > 48, 'long label wraps into a taller button');
assert.ok(long.right <= 320, 'long label stays inside the screen');
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > document.documentElement.clientWidth), false, 'no sideways scrolling');
console.log(`long label: ${Math.round(long.height)}px tall at 320px wide ok`);
await browser.close();
console.log('All button checks passed');
JS
node check-button.mjsThe disabled and second loading clicks pass force: true. Playwright normally waits for a control to be enabled before clicking it, and it counts aria-disabled="true" as not enabled; force skips those checks. Here the point is to click anyway and prove nothing happens.
Check it worked
The script prints one line per group and finishes with "All button checks passed":
primary: 48px tall, rest, hover and pressed ok
secondary: 48px tall, rest, hover and pressed ok
destructive: 48px tall, rest, hover and pressed ok
focus: ring on keyboard focus only ok
disabled: styled, explained, focusable and inert ok
loading: busy, readable and blocks repeat clicks ok
long label: 66px tall at 320px wide ok
All button checks passedThe long-label height can differ by a few pixels with the fonts on your machine. To see a failure, change --colour-accent-hover in tokens.css to another colour and run node check-button.mjs again: it stops at "primary hover" and shows the expected and actual values. Put the value back afterwards.
Step 9 · Clean up
When you have finished with the demo, remove the Chromium download that Playwright added, then the folder. npx playwright uninstall removes only browsers that no other Playwright installation on your machine still uses, so other projects keep theirs. The --all flag is what removes every browser, and you do not need it here:
cd ~/larkfield-button-demo
npx playwright uninstall
cd ~
rm -rf ~/larkfield-button-demoCheck it worked
ls ~/larkfield-button-demo reports that there is no such file or directory.
Next steps
- The design decisions behind this set, including tertiary buttons, sizes and the one-primary-per-screen rule, are in Design buttons: hierarchy, sizes and every state.
- The focus ring here is one colour. For a ring that works on any background, and checks in forced colours mode, see Style keyboard focus with :focus-visible.
- To organise the full Larkfield palette as primitive and semantic tokens, read Turn design tokens into CSS custom properties.
- The next Larkfield component, built from native inputs in the same way, is Build a time slot picker with radio buttons.
Part of these paths
Related tutorials
- Design buttons: hierarchy, sizes and every stateYou will have a button sheet with four kinds, two sizes and six states for each kind, plus a written one-primary-per-screen rule, checked against every screen of the Larkfield Clinic booking app.
- Style keyboard focus with :focus-visibleYou will remove an outline reset that hides keyboard focus, add a two-colour focus ring with :focus-visible that stays visible on white, tinted and accent backgrounds, keep it clear of a sticky header with scroll-margin, check it in forced colours mode and prove it all with a Playwright keyboard test.
- Turn design tokens into CSS custom propertiesYou will have a two-layer tokens.css file of primitive and semantic custom properties, component styles that use only the semantic layer, a Node script that enforces that rule, and a demo page that proves one primitive change reaches every component.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials