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.


                <div is="circular-progress-bar" style="--progress: 80" data-label="Energy" onclick=''></div>

<div is="circular-progress-bar" style="--progress: 50; --color: #2F2" onclick=''></div>

<div is="circular-progress-bar" class="no-progress" style="--progress: 30; --color: #F92" onclick=''>
  <svg width="32" height="32" viewBox="0 0 24 24"> <path fill="#FFF" d="M17.55,11.2C17.32,10.9 17.05,10.64 16.79,10.38C16.14,9.78 15.39,9.35 14.76,8.72C13.3,7.26 13,4.85 13.91,3C13,3.23 12.16,3.75 11.46,4.32C8.92,6.4 7.92,10.07 9.12,13.22C9.16,13.32 9.2,13.42 9.2,13.55C9.2,13.77 9.05,13.97 8.85,14.05C8.63,14.15 8.39,14.09 8.21,13.93C8.15,13.88 8.11,13.83 8.06,13.76C6.96,12.33 6.78,10.28 7.53,8.64C5.89,10 5,12.3 5.14,14.47C5.18,14.97 5.24,15.47 5.41,15.97C5.55,16.57 5.81,17.17 6.13,17.7C7.17,19.43 9,20.67 10.97,20.92C13.07,21.19 15.32,20.8 16.93,19.32C18.73,17.66 19.38,15 18.43,12.72L18.3,12.46C18.1,12 17.83,11.59 17.5,11.21L17.55,11.2M14.45,17.5C14.17,17.74 13.72,18 13.37,18.1C12.27,18.5 11.17,17.94 10.5,17.28C11.69,17 12.39,16.12 12.59,15.23C12.76,14.43 12.45,13.77 12.32,13C12.2,12.26 12.22,11.63 12.5,10.94C12.67,11.32 12.87,11.7 13.1,12C13.86,13 15.05,13.44 15.3,14.8C15.34,14.94 15.36,15.08 15.36,15.23C15.39,16.05 15.04,16.95 14.44,17.5H14.45Z" /> </svg>

function randomize () {
  this.value = Math.round(Math.random() * 100)
function increment () {
  this.value = (this.value + 5) % 100



  --size: 110px
  --weight: 12px
  --color: #29F
  --border: #333
  --background: var(--page-background)
  --progress: 0
  width: var(--size)
  height: var(--size)
  box-sizing: border-box
  background: linear-gradient(var(--background), var(--background)), conic-gradient(var(--color) calc(var(--progress) * 1%), var(--border) calc(var(--progress) * 1%))
  background-origin: border-box
  background-clip: content-box, border-box
  border: var(--weight) solid transparent
  border-radius: 50%
  color: #FFF
  font-size: calc((var(--size) - var(--weight)) / 4.5)
  display: grid
  place-items: center
  place-content: center
    content: ' ' counters(spinner, '0') '%'
    counter-reset: spinner
    counter-increment: spinner var(--progress-label, var(--progress))
    font-weight: bold
    content: attr(data-label)
    font-size: .75em

// Page layout 📰

  --page-background: #111
  min-height: 100vh
  background-color: var(--page-background)
  font-family: "Open Sans", sans-serif
  display: grid
  place-items: center
  place-content: center
  grid-auto-flow: column
  grid-gap: 2rem



                // This isn't necessary for the component to work
// But this makes it easier to change the component's value with a smooth transition!

class CircularProgressBar extends HTMLDivElement {
  get value () {
    return parseInt('--progress'))
  set value (newValue) {
    const animate = (value) => {
      value += (newValue - value) / 4

      const intValue = Math.round(value)'--progress', value)'--progress-label', intValue)

      if (intValue != newValue)
        requestAnimationFrame(() => animate(value))
      else if(value != newValue)
        requestAnimationFrame(() => animate(intValue))
      else return


customElements.define('circular-progress-bar', CircularProgressBar, { extends: 'div' })