Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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>Basic Disclosure Widget</h1>

<button type="button" id="btnDisc01" aria-expanded="false" onclick="toggleDisclosure(;" aria-controls="Disclosed01">
    <svg xmlns="\;" viewBox="0 0 80 80" focusable="false">
      <path d="M70.3 13.8L40 66.3 9.7 13.8z"></path>
  Disclosure Control
<div id="Disclosed01" class="disclosee">
    Here is some disclosed content. <span aria-hidden="true">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span>


                body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.4;

/* All the CSS needed to make disclosures work */

button[aria-expanded="false"] + div {
  display: none;

/* END All the CSS needed to make disclosures work */

button[aria-expanded] {
  border: .1em solid #ccc;
  padding: .5em 1em .5em .5em;
  font: inherit;
  background-color: #eee;
  border-radius: .5em .5em 0 0;

button[aria-expanded] span {
  display: inline-block;
  font-size: 60%;
  color: #000;
  background-color: #00f;
  padding: 0.3em 0.2em 0 0.2em;
  border: 0.2em solid #00f;
  border-radius: 50%;
  line-height: 1;
  text-align: center;
  text-indent: 0;
  transform: rotate(270deg);

button[aria-expanded] svg {
  width: 1.25em;
  height: 1.25em;
  fill: #fff;
  transition: transform 0.25s ease-in;
  transform-origin: center 45%;

button[aria-expanded]:focus {
  background-color: #666;
  color: #fff;
  outline: none;
  border-color: #666;

button[aria-expanded]:hover span,
button[aria-expanded]:focus span {
  background-color: #fff;
  outline: none;

button[aria-expanded]:hover svg,
button[aria-expanded]:focus svg {
  fill: #00f;

/* Lean on programmatic state for styling */
button[aria-expanded="true"] svg {
  transform: rotate(90deg);

.disclosee {
  padding: .25em .75em;
  border: .1em solid #ddd;
  background-color: #fff;
  margin-top: -.1em;


                function toggleDisclosure(btnID) {
  // Get the button that triggered this
  var theButton = document.getElementById(btnID);
  // If the button is not expanded...
  if (theButton.getAttribute("aria-expanded") == "false") {
    // Now set the button to expanded
    theButton.setAttribute("aria-expanded", "true");
  // Otherwise button is not expanded...
  } else {
    // Now set the button to collapsed
    theButton.setAttribute("aria-expanded", "false");