Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <aria-checkbox
	aria-controls="classic classicVars material materialVars toggle custom image"
>All</aria-checkbox>
<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>
<p>
	Native checkbox for comparison, not coupled to above:
	<label for="native"><input type="checkbox" id="native"/>Native</label>
</p>
<fieldset>
	<form>
		<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"/>
	</form>
</fieldset>

              
            
!

CSS

              
                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(https://openclipart.org/image/24px/svg_to_png/214030/Thumbs-Down-Circle.png);
	vertical-align: sub;
	margin-right: .5em;
	display: inline-block;
}
#image[aria-checked="true"]::before {
	content: url(https://openclipart.org/image/24px/svg_to_png/214028/Thumbs-Up-Circle.png);
}
              
            
!

JS

              
                import $ from 'https://cdn.jsdelivr.net/gh/schrotie/shadow-query/shadowQuery.mjs';

// import AriaCheckbox from 'https://cdn.jsdelivr.net/gh/schrotie/aria-checkbox/src/aria-checkbox.mjs';
const AriaCheckbox = ariaCheckbox['default']; // Bundled with ShadowQuery in other codepen

import classicCss   from 'https://cdn.jsdelivr.net/gh/schrotie/aria-checkbox/src/classicCss.mjs';
import materialCss  from 'https://cdn.jsdelivr.net/gh/schrotie/aria-checkbox/src/materialCss.mjs';
import toggleCss    from 'https://cdn.jsdelivr.net/gh/schrotie/aria-checkbox/src/toggleCss.mjs';

window.customElements.define('aria-checkbox', class extends AriaCheckbox {
	constructor() {
		super();
		this.$.on('attr:data-material', this._css.bind(this));
		this.$.shadow(`<style></style><slot>&#8203;</slot>`);
		this._css();
	}

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

              
            
!
999px

Console