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.


                <h1>Listening for Performance Entries</h1>

  Click "Send Request" to make an HTTP request. The <code>PerformanceObserver</code> will receive the performance entry.

<button id="button">Send Request</button>
<button id="reset">Reset</button>




                * {
  font-family: Arial, sans-serif;

pre {
  font-family: Courier New, monospace;
  background: #333;
  color: white;

details {
  padding: 8px;

@keyframes appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  to {
    opacity: 1;
    transform: scale(1);

code {
  font-family: Courier New, monospace;

button {
  background: #4338ca;
  color: white;
  padding: 8px 16px;
  font-size: 1.2em;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;

.entry {
  border: 1px solid gray;
  margin-top: 8px;
  margin-right: 8px;
  border-radius: 3px;
  background: #e0f2fe;
  animation: appear 500ms;

.entry h2 {
  margin: 0;
  font-size: 1.25rem;
  background: #1e40af;
  color: white;
  padding: 8px;

.entry dl {
  font-size: 1.2rem;
  padding: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 0;

.entry dt {
  font-weight: bold;

.entry dd {
  font-family: Courier, monospace;


                const button = document.querySelector('#button');
const list = document.querySelector('ul');
const reset = document.querySelector('#reset');

reset.addEventListener('click', () => {

function showEntry(entry) {
  const el = document.createElement('li');
  el.className = 'entry';

  el.innerHTML = `
    <h2>Performance Entry</h2>
      <summary>Full entry details</summary>
      <pre>${JSON.stringify(entry, null, 2)}</pre>
  list.insertBefore(el, list.firstElementChild);

const observer = new PerformanceObserver(list => {

observer.observe({ type: 'resource' });

button.addEventListener('click', () => {
  const delay = Math.random() * 10;
  button.disabled = true;
  button.textContent = 'Loading...';
  fetch(`${delay}`).then(() => {
    button.disabled = false;
    button.textContent = 'Send Request';