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.


  <button data-change='default'>Default</button>
  <button data-change='fun'>Fun</button>
  <button data-change='serious'>Serious</button>

<section class='example'>
    <h2>Hello! I'm a reusable component</h2>
    <p>It is true.</p>



/* component */
example-component {
  display: block;
  padding: 10px;

/* context */
section.example example-component {
  margin-top: 20px;

/* THEMES */
/* this will target the body - ONLY if it as this value */
/* in our case / the buttons set the theme name */
body[data-theme="default"] {
	background-color: wheat;

body[data-theme="fun"] {
	background-color: var(--pe-red);

body[data-theme="fun"] example-component {
	background-color: var(--pe-red-light);
	border-radius: 6px;

body[data-theme="serious"] {
	background-color: lightgray;

body {
	padding: 30px;


// get the "body" element node and point this reference to it
var site = document.querySelector('body');

// create a function that changes the 'theme'
function changeTheme(chosenThemeName) {
  site.dataset.theme = chosenThemeName;

// listen for clicks
document.addEventListener('click', function(click) {

  // if the clicks happen on the right buttons...
  if ('button') ) {
    // use the data-change thing to set the new theme

// note that you can call the "event" argument whatever you want
// here we named it click to confuse and enlighten you

// start er off
// normally we'd just add the data-theme to the body, but we're in CodePen