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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


                <div id="root"></div>


                body {
  background: #f1f1f1;

.Toast {
  background: white;
  border-left: 1rem solid #8a8a8a;
  border-radius: 0.5rem;
  box-shadow: 0.125rem 0.125rem 0.25rem rgba(0, 0, 0, 0.25);
  display: flex;
  font-family: Helvetica;
  justify-content: space-between;
  padding: 1rem;
  margin: 1rem auto;
  width: 25rem;

.Toast--success {
  border-color: #008554;

.Toast--warning {
  border-color: #FFC627;

.Toast--error {
  border-color: #D14229;  

.Toast__message-category {
  font-weight: bold;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  margin-top: 0;
  text-transform: capitalize;

.Toast__message-text {
  margin-bottom: 0;

.Toast__button {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: inherit;
  margin-left: 1rem;
  opacity: 0.5;
  padding: 0;



                const toasts = [
    category: "success",
    message: "Right on! Your account has been updated."
    category: "warning",
    message: "Hmmm. Something doesn't look right."
    category: "error",
    message: "Uh oh! Something went terribly wrong!"

function Toast(props) {
  return (
    <div className={`Toast Toast--${props.category}`}>
      <main className="Toast__message">
        <header className="Toast__message-category">{props.category}</header>
        <p className="Toast__message-text">{props.message}</p>
      <button className="Toast__button" type="button" onClick={() => props.dismiss(}>

class App extends React.Component {
  render() {
    return (
        {, i) => (
          <Toast category={toast.category} key={i} message={toast.message} />

ReactDOM.render(<App />, document.getElementById("root"));