Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <button class="bookmark">
    <svg viewBox="0 0 36 36">
        <path class="filled" d="M26 6H10V18V30C10 30 17.9746 23.5 18 23.5C18.0254 23.5 26 30 26 30V18V6Z" />
        <path class="default" d="M26 6H10V18V30C10 30 17.9746 23.5 18 23.5C18.0254 23.5 26 30 26 30V18V6Z" />
        <path class="corner" d="M10 6C10 6 14.8758 6 18 6C21.1242 6 26 6 26 6C26 6 26 6 26 6H10C10 6 10 6 10 6Z" />
    </svg>
</button>

<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/ai" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
<a class="twitter" target="_blank" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
              
            
!

CSS

              
                .bookmark {
    --color: #1E2235;
    --back: #ECEFFC;
    --default-position: 32px;
    --default-y: 0px;
    --background-height: 17px;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    outline: none;
    background: none;
    border: none;
    padding: 0;
    margin: 5px 0 0 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    &:before {
        content: '';
        position: absolute;
        top: 0;
        left: 9px;
        width: 18px;
        height: 19px;
        border-radius: 1px;
        clip-path: inset(0 -1px var(--background-height) -1px);
        background: var(--color);
        transform: translateZ(0);
    }
    svg {
        display: block;
        width: 36px;
        height: 36px;
        margin-top: -5px;
        stroke: var(--color);
        stroke-width: 2px;
        stroke-linejoin: round;
        stroke-linecap: round;
        position: relative;
        z-index: 1;
        transform: translateZ(0);
        path {
            fill: var(--fill, var(--back));
            transform: translateZ(0);
            &.default {
                --fill: var(--default-fill, var(--back));
                clip-path: circle(var(--default-position) at 50% 100%);
            }
            &.filled {
                --fill: var(--color);
            }
            &.default,
            &.filled {
                transform: translateY(var(--default-y)) translateZ(0);
            }
        }
    }
}

html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: inherit;
    &:before,
    &:after {
        box-sizing: inherit;
    }
}

// Center & dribbble
body {
    min-height: 100vh;
    display: flex;
    font-family: 'Inter', Arial;
    justify-content: center;
    align-items: center;
    background: #ECEFFC;
    & > label {
        margin: 0 16px;
        &.radio {
            margin: 0 4px;
        }
    }
    .dribbble {
        position: fixed;
        display: block;
        right: 20px;
        bottom: 20px;
        img {
            display: block;
            height: 28px;
        }
    }
    .twitter {
        position: fixed;
        display: block;
        right: 64px;
        bottom: 14px;
        svg {
            width: 32px;
            height: 32px;
            fill: #1da1f2;
        }
    }
}
              
            
!

JS

              
                gsap.registerPlugin(MorphSVGPlugin)

document.querySelectorAll('.bookmark').forEach(button => {
    button.addEventListener('pointerdown', e => {
        if(!button.classList.contains('marked')) {
            return
        }
        gsap.to(button.querySelectorAll('.default, .filled'), {
            morphSVG: 'M26 6H10V18C10 22.6863 11 28 11 28C11 28 17.5273 19.5 18 19.5C18.4727 19.5 25 28 25 28C25 28 26 22.6863 26 18V6Z',
            duration: .15
        })
    })
    button.addEventListener('click', e => {
        e.preventDefault()

        if(button.classList.contains('animated')) {
            return
        }
        button.classList.add('animated')

        if(button.classList.contains('marked')) {
            gsap.fromTo(button.querySelectorAll('.default, .filled'), {
                morphSVG: 'M26 6H10V18C10 22.6863 11 28 11 28C11 28 17.5273 19.5 18 19.5C18.4727 19.5 25 28 25 28C25 28 26 22.6863 26 18V6Z',
                duration: .15
            }, {
                keyframes: [ {
                    morphSVG: 'M26 6H10V18C10 22.6863 8 31 8 31C8 31 15.9746 26.5 18 23.5C20.0254 26.5 28 31 28 31C28 31 26 22.6863 26 18V6Z',
                    duration: .15
                }, {
                    morphSVG: 'M26 6H10V18V30C10 30 17.9746 23.5 18 23.5C18.0254 23.5 26 30 26 30V18V6Z',
                    duration: .6,
                    ease: 'elastic.out(1, .7)',
                    onComplete() {
                        button.classList.remove('marked', 'animated')
                    }
                }]
            })
            gsap.to(button, {
                '--default-position': '24px',
                duration: .2,
                clearProps: true
            })
            return
        }

        gsap.to(button, {
            '--background-height': '0px',
            duration: .125,
            delay: .3
        })
        gsap.to(button, {
            '--default-y': '-28px',
            duration: .4
        })
        gsap.to(button.querySelector('.corner'), {
            keyframes: [{
                morphSVG: 'M10 6C10 6 14.8758 6 18 6C21.1242 6 26 6 26 6C26 6 28 8.5 28 10H8C8 8.5 10 6 10 6Z',
                ease: 'none',
                duration: .125
            }, {
                morphSVG: 'M9.99999 6C9.99999 6 14.8758 6 18 6C21.1242 6 26 6 26 6C26 6 31 10.5 26 14H9.99999C4.99999 10.5 9.99999 6 9.99999 6Z',
                ease: 'none',
                duration: .15
            }, {
                morphSVG: 'M7.99998 16.5C7.99998 16.5 9.87579 22.5 18 22.5C26.1242 22.5 28 16.5 28 16.5C28 16.5 31 20 26 23.5H9.99998C4.99998 20 7.99998 16.5 7.99998 16.5Z',
                ease: 'power1.in',
                duration: .125,
                onComplete() {
                    gsap.set(button.querySelector('.corner'), {
                        fill: 'var(--color)',
                        delay: .05
                    })
                }
            }, {
                morphSVG: 'M8 28C8 28 12.8758 28.5 18 25.5C23.1242 28.5 28 27.5 28 27.5C28 27.5 26 24 26 23.5H10C10 25 8 28 8 28Z',
                ease: 'none',
                duration: .125
            }, {
                morphSVG: 'M10 30C10 30 17.8758 23.5 18 23.5C18.1242 23.5 26 30 26 30C26 30 26 23.5 26 23H10C10 24.5 10 30 10 30Z',
                ease: 'elastic.out(1, .7)',
                duration: .5,
                onComplete() {
                    button.classList.add('marked')
                    button.classList.remove('animated')
                    gsap.set(button, {
                        '--default-y': '0px',
                        '--default-position': '0px',
                        '--background-height': '19px'
                    })
                    gsap.set(button.querySelector('.corner'), {
                        morphSVG: 'M10 6C10 6 14.8758 6 18 6C21.1242 6 26 6 26 6C26 6 26 6 26 6H10C10 6 10 6 10 6Z',
                        clearProps: true
                    })
                }
            }]
        })
    })
})

              
            
!
999px

Console