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.


Save Automatically?

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.


                <h1>funky canvas coat for a wallflower checkbox</h1>
	<canvas id="myCanvas" width="94" height="27"><input type="checkbox" id="check0" title="on/off"></canvas>

	  <li>uses standard HTML checkbox</li>
	  <li>keyboard operable</li>
	  <li>role/name/state/properies and interaction exposed to acc layer without need for ARIA or custom keyboard Jazz.</li>
    <li>No JavaScript? no canvas support? no problem, defaults to standard checkbox (Except in IE - <a href="">bug filed</a>)</li>

<h2>HTML code:</h2>
&lt;canvas id=&quot;myCanvas&quot; width=&quot;94&quot; height=&quot;27&quot;&gt;
&lt;input type=&quot;checkbox&quot; id=&quot;check0&quot; title=&quot;on/off&quot;&gt;


                body {font-family:sans-serif;}



                var canvas = document.getElementById('myCanvas');
		var checkbox = document.getElementById('check0') ;
		var context = canvas.getContext('2d');
		var imageObj = new Image();
		var noCheckedUpdate = false;

		imageObj.onload = function() {
			context.drawImage(imageObj, 0, 0);
		imageObj.src = '';
		canvas.addEventListener("click", doClick, false);
		checkbox.addEventListener("change", doChange, false);
		checkbox.addEventListener("focus", doFocus, false);
		checkbox.addEventListener("blur", doBlur, false);

		function doClick() {
			toggleImg(noCheckedUpdate ? checkbox.checked : !checkbox.checked);

		function doChange(event) {
			noCheckedUpdate = true;
			toggleImg(, true);		

		function toggleImg(turnOn, leaveCheckedAlone) {
			imageObj.src = turnOn ? '' : ''; 
			if (!noCheckedUpdate) {
				checkbox.checked = turnOn;
				noCheckedUpdate = false;

		function doFocus(event) {'solid #8080FF medium';

		function doBlur() {'solid #fff medium';