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 class="container">
  <div class="bar bar-grey">
    <div class="option">ONE</div>
    <div class="option">TWO</div>
    <div class="option">THREE</div>
  <div class="bar-outer">
    <div class="bar bar-purple">
      <div class="option">ONE</div>
      <div class="option">TWO</div>
      <div class="option">THREE</div>


                body {
  align-items: center;
  display: flex;
  font-family: sans-serif;
  font-size: 14px;
  justify-content: center;
  height: 100vh;
.container {
  align-items: center;
  background: #eeedef;
  display: flex;
  height: 160px;
  justify-content: center;
  position: relative;
  width: 360px;
.bar {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  height: 32px;
  left: 0;
  padding: 0 21px;
  position: absolute;
  width: 100%;
.bar-purple {
  background: #6000ea;
  color: white;
  clip-path: polygon(
    360px 0,
    360px 32px,
    43px 32px,
    39.775442px 31.67494px,
    36.772078px 30.74264px,
    34.054248px 29.26745px,
    31.686292px 27.31371px,
    29.732549px 24.94575px,
    28.257359px 22.22792px,
    27.325063px 19.22456px,
    27px 16px,
    27.325063px 12.77544px,
    28.257359px 9.77208px,
    29.732549px 7.05425px,
    31.686292px 4.68629px,
    34.054248px 2.73255px,
    36.772078px 1.25736px,
    39.775442px 0.32506px,
    43px 0
  transition: clip-path 200ms cubic-bezier(0.4, 0, 0.2, 1);
.option {
  cursor: pointer;
  line-height: 142px;
  text-align: center;
  width: 33.33%;
.bar-outer {
  clip-path: polygon(0 0, 120px 0, 120px 32px, 0 32px);
  clip-path: polygon(
    0 0,
    0 32px,
    104px 32px,
    107.22456px 31.67494px,
    110.22792px 30.74264px,
    112.94575px 29.26745px,
    115.31371px 27.31371px,
    117.26745px 24.94575px,
    118.74264px 22.22792px,
    119.67494px 19.22456px,
    120px 16px,
    119.67494px 12.77544px,
    118.74264px 9.77208px,
    117.26745px 7.05425px,
    115.31371px 4.68629px,
    112.94575px 2.73255px,
    110.22792px 1.25736px,
    107.22456px 0.32506px,
    104px 0
  height: 32px;
  pointer-events: none;
  transition: clip-path 200ms cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
.bar-outer.pos2 .bar-purple {
  clip-path: polygon(
    360px 0,
    360px 32px,
    149px 32px,
    145.775442px 31.67494px,
    142.772078px 30.74264px,
    140.054248px 29.26745px,
    137.686292px 27.31371px,
    135.732549px 24.94575px,
    134.257359px 22.22792px,
    133.325063px 19.22456px,
    133px 16px,
    133.325063px 12.77544px,
    134.257359px 9.77208px,
    135.732549px 7.05425px,
    137.686292px 4.68629px,
    140.054248px 2.73255px,
    142.772078px 1.25736px,
    145.775442px 0.32506px,
    149px 0
.bar-outer.pos2 {
  clip-path: polygon(
    0 0,
    0 32px,
    210px 32px,
    213.22456px 31.67494px,
    216.22792px 30.74264px,
    218.94575px 29.26745px,
    221.31371px 27.31371px,
    223.26745px 24.94575px,
    224.74264px 22.22792px,
    225.67494px 19.22456px,
    226px 16px,
    225.67494px 12.77544px,
    224.74264px 9.77208px,
    223.26745px 7.05425px,
    221.31371px 4.68629px,
    218.94575px 2.73255px,
    216.22792px 1.25736px,
    213.22456px 0.32506px,
    210px 0
.bar-outer.pos3 .bar-purple {
  clip-path: polygon(
    360px 0,
    360px 32px,
    256px 32px,
    252.775442px 31.67494px,
    249.772078px 30.74264px,
    247.054248px 29.26745px,
    244.686292px 27.31371px,
    242.732549px 24.94575px,
    241.257359px 22.22792px,
    240.325063px 19.22456px,
    240px 16px,
    240.325063px 12.77544px,
    241.257359px 9.77208px,
    242.732549px 7.05425px,
    244.686292px 4.68629px,
    247.054248px 2.73255px,
    249.772078px 1.25736px,
    252.775442px 0.32506px,
    256px 0
.bar-outer.pos3 {
  clip-path: polygon(0 0, 333px 0, 333px 32px, 0 32px);
  clip-path: polygon(
    0 0,
    0 32px,
    317px 32px,
    320.22456px 31.67494px,
    323.22792px 30.74264px,
    325.94575px 29.26745px,
    328.31371px 27.31371px,
    330.26745px 24.94575px,
    331.74264px 22.22792px,
    332.67494px 19.22456px,
    333px 16px,
    332.67494px 12.77544px,
    331.74264px 9.77208px,
    330.26745px 7.05425px,
    328.31371px 4.68629px,
    325.94575px 2.73255px,
    323.22792px 1.25736px,
    320.22456px 0.32506px,
    317px 0
.bar-outer.left .bar-purple {
  transition-delay: 0;
.bar-outer.left {
  transition-delay: 80ms;
.bar-outer.right .bar-purple {
  transition-delay: 80ms;
.bar-outer.right {
  transition-delay: 0;


                const barOuter = document.querySelector(".bar-outer");
const options = document.querySelectorAll(".bar-grey .option");
let current = 1;
options.forEach((option, i) => (option.index = i + 1));
options.forEach(option =>
                option.addEventListener("click", function() {
  barOuter.className = "bar-outer";
  if (option.index > current) {
  } else if (option.index < current) {
  current = option.index;