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.


  <label class="sr-only" for="copy-text">Text to copy</label>
  <input id="copy-text" type="text" value="pop-up-key" readonly disabled>
  <button class="button ripple">Copy to clipboard</button>
<div id="notification-pop-up" popover="manual">
  <div class="popup-content">
    <span>Copied to clipboard!</span>
    <svg viewBox="0 0 384 512" title="clipboard-check" role="img">
      <path d="M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm121.2 231.8l-143 141.8c-4.7 4.7-12.3 4.6-17-.1l-82.6-83.3c-4.7-4.7-4.6-12.3.1-17L99.1 285c4.7-4.7 12.3-4.6 17 .1l46 46.4 106-105.2c4.7-4.7 12.3-4.6 17 .1l28.2 28.4c4.7 4.8 4.6 12.3-.1 17z" />


                @layer normalize, open-props, base, mdl, demo;

@layer demo {
  /* Demo */

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;

  [popover] {
    position: fixed;
    top: var(--size-4);
    left: 50%;
    padding: var(--size-4);
    transition: transform 0.2s;
    transform: translate(-50%, calc((200% + var(--size-4)) * -1))
      translateY(calc((200% + var(--size-4)) * var(--show, 0)));
    margin: 0;
    box-shadow: var(--shadow-5);
    border: 0;
    border-radius: var(--radius-3);
    background: var(--blue-3);
    color: var(--gray-0);

  [popover]:open {
    --show: 1;

  .popup-content {
    display: flex;
    align-items: center;
    gap: 1ch;
    font-size: var(--font-size-fluid-0);
    font-weight: var(--font-weight-6);

  span {
    white-space: nowrap;

  svg {
    fill: var(--gray-0);
    width: 2ch;
    min-width: 2ch;
    transform: translateY(-6%);

  input {
    padding: var(--size-4);
    text-align: center;

  main {
    display: flex;
    gap: 1ch;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;

@layer base {
  *:before {
    box-sizing: border-box;

  :where([popover]) {
    margin: auto;
    border-width: initial;
    border-style: solid;

  body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    font-family: "Google Sans", sans-serif, system-ui;
    align-content: center;



                const INPUT = document.querySelector("input");
const POPUP = document.querySelector("[popover]");
const BUTTON = document.querySelector("button");

const copyToClipboard = () => {
  if (!POPUP.matches(":open")) {
    // Grab the text and use the clipboard API
    navigator.clipboard.writeText(INPUT.value).then(() => {
      setTimeout(() => POPUP.hidePopover(), 2000);

BUTTON.addEventListener("click", copyToClipboard);