css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <main>
  <div data-tab-component>
    <h1 class="base--h1">A11Y Tabs</h1>
    <ul class="tab-list">
      <li class="tab-item">
        <a class="tab-link" href="#section-0">Planning</a>
      </li>
      <li class="tab-item">
        <a class="tab-link" href="#section-1">Feedback</a>
      </li>
      <li class="tab-item">
        <a class="tab-link" href="#section-2">Retrospective</a>
      </li>
    </ul>
    <section id="section-0" class="tab-panel">
      <h2>Planning</h2>
      <p>
        Pixel pushing game-plan, yet core competencies, or table the discussion quick win. Collaboration through advanced technlogy i also believe it's important for every member to be involved and invested in our company and this is one way to do so but low-hanging fruit reach out. Deliverables t-shaped individual. 
      </p>
      <p>
        Push back drill down. We need distributors to evangelize the new line to local markets productize or game plan drop-dead date we're ahead of the curve on that one nor win-win <a target="_blank" href="https://alistapart.com/topic/usability">usabiltiy</a>.
      </p>
      <p>
        Future-proof paddle on both sides i'll book a meeting so we can solution this before the sprint is over so sacred cow productize due diligence. We're ahead of the curve on that one closer to the metal show pony, or mobile friendly. 
      </p>
      <p>
        Strategic high-level 30,000 ft view upsell shotgun approach closer to the metal, we need distributors to evangelize the new line to local markets, yet collaboration through advanced technlogy. Imagineer strategic high-level 30,000 ft view work flows , or quick win, yet curate, but deploy anti-pattern.
      </p>
    </section>
    <section id="section-1" class="tab-panel">
      <h2>Feedback</h2>
      <p>
        Can you use a high definition screenshot can you make the blue bluer? and I got your invoice...it seems really high, why did you charge so much, for we are your relatives. There are more projects lined up charge extra the next time will royalties in the company do instead of cash. 
      </p>
      <p>
        Make it look like Apple theres all this spanish text on my site can you make the logo bigger yes bigger bigger still the logo is too big but concept is bang on, but can we look at a better execution, and the website doesn't have the theme i was going for or can you pimp this powerpoint, need more geometry patterns make it sexy.
      </p>
      <p>
        Concept is bang on, but can we look at a better execution im not sure, try something else, for remember, everything is the same or better and can you make it stand out more?, nor low resolution? It looks ok on my screen thats not what i saw in my head at all can you make pink a little more pinkish. I need a website. 
      </p>
      <p>
        How much will it cost this looks perfect. Just <a target="_blank" href="http://theoatmeal.com/comics/design_hell">Photoshop out the dog, add a baby, and make the curtains blue</a> can you make the logo bigger yes bigger bigger still the logo is too big I need a website. How much will it cost, so im not sure, try something else, nor can you make it pop.
      </p>
    </section>
    <section id="section-2" class="tab-panel">
      <h2>Retrospective</h2>
      <p>
        High turnaround rate globalize first-order optimal strategies. Ramp up game-plan i also believe it's important for every member to be involved and invested in our company and this is one way to do so. Overcome key issues to meet key milestones get buy-in are we in agreeance, and knowledge is power. Into the weeds fire up your browser deploy, or deploy, value-added high-level. 
      </p>
      <p>
        Vertical integration deliverables yet shelfware. It just needs <a target="_blank" href="https://www.youtube.com/watch?v=Q_MWeOs8Ffg">more cowbell</a> we need more paper, but guerrilla marketing, for dogpile that. Organic growth idea shower, yet strategic fit. Can we take this offline where do we stand on the latest client ask come up with something buzzworthy, nor shoot me an email and your work on this project has been really impactful.
      </p>
      <p>
        Can I just chime in on that one bleeding edge drill down, and cross-pollination, or those options are already baked in with this model.
      </p>
    </section>
  </div>
</main>
            
          
!
            
              main {
  padding: 1rem;
}

[role="tablist"] {
  background: #0d8a00;
  padding: 0;
  margin: 0;
}

[role="presentation"] {
  display: block;
}

[role="presentation"][data-tab-active] {
  background: #036800;
  -webkit-transition: all 100ms cubic-bezier(0.42, 0, 1, 1);
  transition: all 100ms cubic-bezier(0.42, 0, 1, 1);
}

[role="tab"] {
/*   border: 3px solid transparent; */
  color: #fff;
  display: block;
  padding: 1rem 2rem;
  position: relative;
  text-decoration: none;
  -webkit-transition: all 100ms cubic-bezier(0.42, 0, 1, 1);
  transition: all 100ms cubic-bezier(0.42, 0, 1, 1);
}

[role="tab"]:focus {
    outline: 0;
    background-color: #0d8a00;
    box-shadow: inset 0 0 0 3px #036800;
}

[role="tabpanel"] {
  background: #f0f0f0;
  padding: 1rem;
}

[role="tabpanel"] h2 {
  margin-top: 0;
}

[role="tabpanel"][aria-hidden="true"] {
  display: none;
}

[role="tabpanel"]:focus {
  outline: 0;
  box-shadow: inset 0 0 0 2px #036800;
}

@media screen and (min-width: 800px) {
  [role="presentation"] {
    display: inline-block;
  }

  [role="presentation"][data-tab-active] [role="tab"]:after {
    content: '';
    display: inline-block;
    margin: auto;
    position: absolute;
    bottom: -9px;
    left: 0;
    right: 0;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #036800;
  }
}

            
          
!
            
              (function tabComponentIIFE(window) {
  'use strict';
  var TabComponent = function tabComponentConstructor(selector) {
    const element = document.querySelector(selector);
    if (!element || !element.nodeType) {
      throw new Error('The DOM element was not found when creating the tab component');
    }
    return TabComponent.init(element);
  }
  

  TabComponent.prototype = {
    handleTabInteraction: function handleTabInteraction(index, direction) {
      const currentIndex = this.currentIndex;
      let newIndex = index;
   
      if (direction) {
        if (direction === 37) {
          newIndex = index - 1;
        } else {
          newIndex = index + 1
        }
      }
      
      if (newIndex < 0) {
        newIndex = this.tabs.length - 1 ;
      } else if (newIndex === this.tabs.length) {
        newIndex = 0;
      }
      
      // update tabs
      this.tabs[currentIndex].setAttribute('tabindex', '-1');
      this.tabs[currentIndex].removeAttribute('aria-selected');
      this.tabItems[currentIndex].removeAttribute('data-tab-active');
      
      this.tabs[newIndex].setAttribute('aria-selected', 'true');
      this.tabItems[newIndex].setAttribute('data-tab-active', '');
      this.tabs[newIndex].removeAttribute('tabindex');
      this.tabs[newIndex].focus();
      
      // update tab panels
      this.tabPanels[currentIndex].setAttribute('hidden', '');
      this.tabPanels[newIndex].removeAttribute('hidden');
      
      this.currentIndex = newIndex;
      
      return this;
    },
    
    handleTabpanelFocus: function handleTabPanelFocus(index) {
      this.tabPanels[index].focus();
      
      return this;
    }
  };
  
  // Intialize Tab Component
  TabComponent.init = function tabComponentInit(element) {
    this.tabList = element.querySelector('.tab-list');
    this.tabItems = [].slice.call(this.tabList.querySelectorAll('.tab-item'));
    this.tabs = [].slice.call(this.tabList.querySelectorAll('.tab-link'));
    this.tabPanels = [].slice.call(element.querySelectorAll('.tab-panel'));
    this.currentIndex = 0;
    this.tabList.setAttribute('role', 'tablist');

    this.tabItems.forEach((item, index) => {
      item.setAttribute('role', 'presentation');
      
      if (index === 0) {
        item.setAttribute('data-tab-active', '');
      }
    });

    this.tabs.forEach((item, index) => {
      item.setAttribute('role', 'tab');
      item.setAttribute('id', 'tab' + index);
      
      if (index > 0) {
        item.setAttribute('tabindex', '-1');
      } else {
        item.setAttribute('aria-selected', 'true');
      }
    });

    this.tabPanels.forEach((item, index) => {
      item.setAttribute('role', 'tabpanel');
      item.setAttribute('aria-labelledby', 'tab' + index);
      item.setAttribute('tabindex', '-1');

      if (index > 0) {
        item.setAttribute('hidden', '');
      }
    });
  
    this.tabList.addEventListener('click', event => {
      event.preventDefault();
       TabComponent.prototype.handleTabInteraction.call(this, this.tabs.indexOf(event.target));
    });

    this.tabList.addEventListener('keydown', event => {
      const index = this.tabs.indexOf(event.target);

      // Left and right arrows
      if (event.which === 37 || event.which === 39) {
        event.preventDefault();
        TabComponent.prototype.handleTabInteraction.call(this, index, event.which);
      }

      // Down arrow
      if (event.which === 40) {
        event.preventDefault();
        TabComponent.prototype.handleTabpanelFocus.call(this, index);
      }
    });

    return this;
  }

  window.tabs = TabComponent
})(window);

const tabComponent = tabs('[data-tab-component]');
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console