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.


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 { 
  color: white;
  background-color: black;
.App {
  font-family: sans-serif;
  text-align: center;
h1 {
  /* opacity: 0; */



                const { useEffect, useRef, StrictMode } = React;
const { createRoot } = ReactDOM;

const root = createRoot(document.getElementById("root"));
let callCount = 0;

function App() {
  const component = useRef(null); // we only need a ref for the root-level element of this component so we can use selector text for everything else.

  useEffect(() => {
    console.log("useEffect() call", ++callCount, "(React 18 strict mode calls twice!)");
    // create a context for all the GSAP animations and ScrollTriggers so we can revert() them in one fell swoop.
    // A context also lets us scope all the selector text to the component (like feeding selector text through component.querySelectorAll(...)) 
    let ctx = gsap.context(() => {
      // create as many GSAP animations and/or ScrollTriggers here as you want...
      gsap.from("h1", { // <- selector text, scoped to this component!
        opacity: 0,
        y: 100,
        ease: "power3",
        duration: 2
    }, component); // <- scopes all selector text inside the context to this component (optional, default is document)
    return () => ctx.revert(); // cleanup! 
  }, []);

  return (
    <div ref={component} className="App">
      <h1>gsap.context() + React = 💚</h1>

    <App />