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.


                <div id="app">
        <div slot-scope="{ on, setOn, setOff }" class="container">
            <button @click="click(setOn)" class="button">Blue pill</button>
            <button @click="click(setOff)" class="button isRed">Red pill</button>
            <div v-if="buttonPressed" class="message">
                <span v-if="on">It's all a dream, go back to sleep.</span>
                <span v-else>I don't know how far the rabbit hole goes, I'm not a rabbit, neither do I measure holes.</span>



                body {
    display: flex;
    height: 100vh;
    align-items: center;
    justify-content: center;

.container {
    position: relative;

.button {
    border: none;
    padding: 1rem 2rem;
    border-radius: 2rem;
    cursor: pointer;
    background: blue;
    color: white;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
  Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
  'Segoe UI Symbol';
    font-weight: bold;
    outline: none;
    box-shadow: 0 4px 2px 1px rgba(slategray, .2);
    &.isRed {
        background: red;

.message {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    padding: 1rem;
    text-align: center;
    font-size: 1.25rem;


                const toggle = {
    props: {
        on: { type: Boolean, default: false }
    render() {
        return this.$scopedSlots.default({
            on: this.currentState,
            setOn: this.setOn,
            setOff: this.setOff,
            toggle: this.toggle,
    data() {
        return { currentState: this.on }
    methods: {
        setOn() {
            this.currentState = true
        setOff() {
            this.currentState = false
        toggle() {
            this.currentState = !this.currentState

new Vue({
    el: '#app',
    components: { toggle },
    data: {
        buttonPressed: false,
    methods: {
        click(fn) {
            this.buttonPressed = true