Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


	aria-controls="classic classicVars material materialVars toggle custom image"
<aria-checkbox id="classic"                           >classic</aria-checkbox>
<aria-checkbox id="classicVars"                       >CSS vars</aria-checkbox>
<aria-checkbox id="material"     data-theme="material">material</aria-checkbox>
<aria-checkbox id="materialVars" data-theme="material">material CSS vars</aria-checkbox>
<aria-checkbox id="toggle"       data-theme="toggle"  >toggle</aria-checkbox>
<aria-checkbox id="custom"       data-theme="material">custom</aria-checkbox>
<aria-checkbox id="image"        data-theme="custom"  >image</aria-checkbox>
	Native checkbox for comparison, not coupled to above:
	<label for="native"><input type="checkbox" id="native"/>Native</label>
		<legend>Form Test</legend>
		<p>&lt;aria-checkbox&gt; maintains an invisible &lt;input type="checkbox"&gt; in sync. Thus you can drop it into any form where it behaves like a built in checkbox. In this example the form submit will reload this demo and display the value in the URL query.
		<aria-checkbox data-theme="material" name="foo" value="bar">form value</aria-checkbox>
		<input type="submit"/>



                aria-checkbox, label {
	margin: 1em;
	display: block;
#classicVars {
	--aria-checkbox-bg-unchecked: #d4f1d1;
	--aria-checkbox-bg-checked: #00ff00;
	--aria-checkbox-fg-checked: #ff0000;
#materialVars {
	--aria-checkbox-bg-unchecked: #ffc793;
	--aria-checkbox-bg-checked: #ff7b00;
	--aria-checkbox-fg-checked: #fffc00;
#custom {
	--aria-checkbox-bg-checked: #ff9a9a;
#custom::before {
	border-radius: 50% !important;
	font-size: 1.2em;
#custom[aria-checked="true"]::after {
	content: '✓';
	border: none;
	transform: translateX(-120%) translateY(-80%);
	color: #ca0000;
	font-size: 1.5em;
#image {
	cursor: pointer;
	outline: none;
#image:focus::before       {border-bottom: 1px solid #ff7b00;}
#image:hover::before       {border-bottom: 1px solid #ff7b00;}
#image:hover:focus::before {border-bottom: 2px solid #ff7b00;}
#image::before {
	content: url(;
	vertical-align: sub;
	margin-right: .5em;
	display: inline-block;
#image[aria-checked="true"]::before {
	content: url(;


                import $ from '';

// import AriaCheckbox from '';
const AriaCheckbox = ariaCheckbox['default']; // Bundled with ShadowQuery in other codepen

import classicCss   from '';
import materialCss  from '';
import toggleCss    from '';

window.customElements.define('aria-checkbox', class extends AriaCheckbox {
	constructor() {
		this.$.on('attr:data-material', this._css.bind(this));

	_css() {
		const template = {
			'toggle':   toggleCss,
			'material': materialCss,
			'custom':   ' ',
		}[this.$.attr('data-theme')] || classicCss;
		$(this, 'style').append({template});