# A decent custom checkbox pattern for until ::checkmark is ready

DevFeed: [A decent custom checkbox pattern for until ::checkmark is ready](<https://devfeed.tech/articles/a-decent-custom-checkbox-pattern-for-until-checkmark-is-ready-45412.md>)

Original publisher: [Read original article](<https://piccalil.li/blog/a-decent-custom-checkbox-for-until-checkmark-is-ready/?ref=main-rss-feed>)

Author: Andy Bell

Published: 2026-09-17T11:55:00Z

Content type: tutorial

Language: en

Sources: [Piccalilli - Everything](<https://devfeed.tech/sources/piccalilli-everything.md>)

Topics: [CSS](<https://devfeed.tech/topics/css.md>), [Forms](<https://devfeed.tech/topics/forms.md>), [HTML](<https://devfeed.tech/topics/html.md>), [SVG](<https://devfeed.tech/topics/svg.md>), [aria](<https://devfeed.tech/topics/aria.md>), [Web platform](<https://devfeed.tech/topics/web-platform.md>)

Tags: [aria](<https://devfeed.tech/tags/aria.md>), [code](<https://devfeed.tech/tags/code.md>), [css](<https://devfeed.tech/tags/css.md>), [forms](<https://devfeed.tech/tags/forms.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [html](<https://devfeed.tech/tags/html.md>), [svg](<https://devfeed.tech/tags/svg.md>)

## AI overview

A tutorial for building a custom checkbox with HTML, CSS, and an inline SVG checkmark while preserving keyboard focus and accessibility. It presents an interim pattern until browser support for newer checkbox styling features becomes available.

## Source excerpt

Now that we can better customise <select> elements, it's only natural to side-eye other form <input> types that have caused us visual headaches. Sure, we should be applying the lightest of touches to form elements, especially, but even with a bit of visual-massaging, checkboxes are limited, aside from a bit of accent-color. See the Pen Standard checkbox with accent colour by Andy Bell (@piccalilli) on CodePen. There is a brighter future incoming, if you're to read the spec: The ::checkmark pseudo-element represents an indicator of whether the item is checked, and is present on checkboxes, radios, and option elements. -- W3C forms level 1 Match that with appearance: base, which is also incoming, and we're looking at this sort of CSS: input[type="checkbox"] { appearance: base; } input[type="checkbox"]::checkmark { content: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5 12l5 5L20 7' /%3E %3C/svg%3E"); } We're miles off from that capability yet -- it doesn't look like any browser is working on it -- so allow me to show you how to build a nice custom checkbox pattern for until we have the browser capabilities we're after. HTML first, always It's always right to start with some good quality markup: <label for="custom-checkbox" class="checkbox"> <span class="checkbox__box"> <input type="checkbox" name="custom-checkbox" id="custom-checkbox" value="Some value that this control toggles"> <svg aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m5 12l5 5L20 7" /> </svg> </span> <span>A long label for this checkbox to make sure we get a nice wrapping behaviour</span> </label> The markup is pretty straig