Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div ng-app="myApp" class="u-narrowWrapper u-paddingHm u-paddingTl" ng-controller="MainController">
      
  <header class="u-marginBl u-textCenter">
    <div>
      <svg class="u-inlineBlock" width="58px" height="58px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54"><g><path fill="#4CAF50" d="M3.1,27.9c0,0,10.2-24.1,11.6-27.2c0.2-0.5,0.6-0.8,1.2-0.6c0.5,0.1,0.8,0.7,1.5,2.2c1.3,2.9,18,37.2,18.7,38.6c0.8,1.6,1,2.6,0.7,3.4c-0.3,0.6-1,1.1-1.8,1.4c-2.3,0.9-20.3,7.8-21.5,8.3c-0.7,0.3-0.8-0.4-1.4-1.7C11.6,51,3.7,32.1,3.1,30.7C2.5,29.3,3.1,27.9,3.1,27.9z"/><path fill="#2196F3" d="M50.9,17.3c-0.3-0.3-0.4-0.4-0.7-0.2c-0.3,0.1-11.5,8.6-16.8,12.5c2.7,5.5,4.7,9.7,5,10.2c0.4,0.8,0.8,1.7,1,2.6c0.1-0.2,0.2-0.3,0.3-0.5c0.9-1.8,11.3-23.4,11.5-23.8C51.3,17.7,51.2,17.7,50.9,17.3z"/></g></svg>
      <h2 class="u-marginTs">vTabs</h2>
      <p>Dynamic, flexible and accessible AngularJS tabs.</p>
    </div>

    <hr>

  </header>

  <div class="u-marginBl">

    <section class="u-paddingBl">

      <h3 class="u-marginBl">Tabs</h3>

      <v-tabs class="vTabs--default" id="tebs" horizontal control="simpleTabs" active="simpleTabs.active">
        <v-tab ng-repeat="page in pages" ng-bind="page.title"></v-tab>
      </v-tabs>

      <p class="u-marginVm"><small>Current: <b>{{ simpleTabs.active + 1 }}</b></small></p>

      {{ $tabs }}
    </section>

    <section class="u-paddingBl">

      <h3 class="u-marginBl">Pages</h3>

      <v-pages class="vPages--default" control="simplePages" active="simplePages.active">
        <v-page ng-repeat="page in pages">
          <div class="u-formatedText" ng-bind-html="page.content"></div>
        </v-page>
      </v-pages>

      <p class="u-marginTm"><small>Current: <b>{{ simplePages.active + 1 }}</b></small></p>

      <div class="ButtonGroup ButtonGroup--hz u-marginVm">
        <div class="ButtonGroup-item u-marginRm">
          <button class="Button" ng-click="simplePages.previous()">Previous</button>
        </div>
        <div class="ButtonGroup-item">
          <button class="Button" ng-click="simplePages.next()">Next</button>
        </div>
      </div>

    </section>

    <section class="u-paddingBl">

      <h3 class="u-marginBl">Tabs with pages</h3>

      <v-tabs class="vTabs--default" horizontal control="horizontalTabs" active="horizontalTabs.active">
        <v-tab id="tabH_{{ ::page.id }}" aria-controls="pageV_{{ ::page.id }}" ng-repeat="page in pages" ng-bind="page.title"></v-tab>
      </v-tabs>

      <v-pages class="vPages--default" active="horizontalTabs.active" ng-swipe-left="horizontalTabs.next()" ng-swipe-right="horizontalTabs.previous()">
        <v-page id="pageH_{{ ::page.id }}" aria-labelledby="tabH_{{ ::page.id }}" ng-repeat="page in pages">
          <div class="u-formatedText" ng-bind-html="page.content"></div>
        </v-page>
      </v-pages>

    </section>

  </div>

  <hr>

  <footer class="u-cf u-paddingBl">

    <div class="u-textCenter">
      <a href="https://codepen.io/LukaszWatroba" target="_blank" class="u-inlineBlock u-linkClean">
        <svg width="28px" height="28px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54"><g><path fill="#2196F3" d="M3.1,27.9c0,0,10.2-24.1,11.6-27.2c0.2-0.5,0.6-0.8,1.2-0.6c0.5,0.1,0.8,0.7,1.5,2.2c1.3,2.9,18,37.2,18.7,38.6c0.8,1.6,1,2.6,0.7,3.4c-0.3,0.6-1,1.1-1.8,1.4c-2.3,0.9-20.3,7.8-21.5,8.3c-0.7,0.3-0.8-0.4-1.4-1.7C11.6,51,3.7,32.1,3.1,30.7C2.5,29.3,3.1,27.9,3.1,27.9z"/><path fill="#2196F3" d="M50.9,17.3c-0.3-0.3-0.4-0.4-0.7-0.2c-0.3,0.1-11.5,8.6-16.8,12.5c2.7,5.5,4.7,9.7,5,10.2c0.4,0.8,0.8,1.7,1,2.6c0.1-0.2,0.2-0.3,0.3-0.5c0.9-1.8,11.3-23.4,11.5-23.8C51.3,17.7,51.2,17.7,50.9,17.3z"/></g></svg>
        <br>
        <small>
          By Łukasz Wątroba
        </small>
      </a>
    </div>

  </footer>

</div>


<!-- Fork me on GitHub ribbon -->
<a href="https://github.com/LukaszWatroba/v-tabs"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>

              
            
!

CSS

              
                // Demo
.u-narrowWrapper { max-width: 32em; }


/**
 * Example HTML:
 *
   <v-tabs class="vTabs--default" horizontal active="activeTabIndex">
     <v-tab>[title]</v-tab>
   </v-tabs>

   <v-pages class="vPages--default" active="activeTabIndex">
     <v-page>
       <h3>[title]</h3>
       <p>[content]</p>
     </v-page>
   </v-pages>
 */


// -------------------------------------
// Settings
// -------------------------------------


$v-tabs-default-theme:    true !default;
$v-pages-default-theme:   true !default;


// Tabs
// -------------------------------------
$v-tabs-spacing:            20px !default;

$v-tabs-default-color:      #D8D8D8 !default;
$v-tabs-active-color:       #2196F3 !default;

$v-tabs-tab-min-width:      100px !default;

$v-tabs-hover-animation-duration:  0.25s !default;
$v-tabs-enter-animation-duration:  0.5s  !default;
$v-tabs-leave-animation-duration:  0.25s !default;

$v-tabs-disabled-opacity:          0.6 !default;


// Pages
// -------------------------------------

$v-pages-spacing:  20px !default;

$v-pages-enter-animation-duration:  0.5s  !default;
$v-pages-leave-animation-duration:  0.25s !default;



/***************************************
  Tabs
 ***************************************/


v-tabs {
  display: flex;
  position: relative;
  min-width: 100%;
}

v-tab {
  flex: 1;
  position: relative;
  color: inherit;

  &.is-active {
    color: $v-tabs-active-color;
  }

  &[disabled] {
    pointer-events: none;
  }
}

v-tab:not([inactive]) {
  cursor: pointer;
}

v-tabs[horizontal] {
  flex-direction: row;
  align-items: stretch;
  overflow-x: auto;

  v-tab {
    text-align: center;
    min-width: $v-tabs-tab-min-width;
  }
}

v-tabs[vertical] {
  flex-direction: column;

  v-tab {
    text-align: left;
  }
}



/***************************************
  Pages
 ***************************************/


v-pages {
  display: block;
  position: relative;
}

v-page {
  display: none;
  position: relative;

  &.is-active {
    display: block;
  }
}



/* Theme: Tabs
 ***************************************/


.vTabs--default {
  margin-bottom: $v-tabs-spacing;

  v-tab {
    transition: color $v-tabs-hover-animation-duration;
    outline: none;

    &::after {
      content: '';
      position: absolute;
      display: block;
      left: 0;
      background-color: $v-tabs-default-color;
      transition: background-color $v-tabs-enter-animation-duration $v-tabs-leave-animation-duration;
    }

    &.is-active {
      &::after {
        background-color: $v-tabs-active-color;
      }
    }

    &.is-active-remove {
      &::after {
        transition: background-color $v-tabs-leave-animation-duration;
      }
    }

    &:focus {
      outline: none;
    }

    &:hover,
    &:focus {
      color: $v-tabs-active-color;
    }

    &[disabled] {
      opacity: $v-tabs-disabled-opacity;

      &:hover,
      &:focus {
        color: inherit;
      }
    }
  }

  &[horizontal] v-tab {
    padding: $v-tabs-spacing / 2;

    &::after {
      width: 100%;
      height: 2px;
      bottom: 0;
    }
  }

  &[vertical] v-tab {
    padding: $v-tabs-spacing / 2 $v-tabs-spacing;

    &::after {
      width: 2px;
      height: 100%;
      top: 0;
      bottom: auto;
    }
  }
}



/* Theme: Pages
 ***************************************/


.vPages--default {
  margin-bottom: $v-tabs-spacing;

  v-page {
    will-change: transform, opacity;
    opacity: 0;
    transform: translateY(30px);

    &.is-active {
      opacity: 1;
      transform: translateY(0);
    }

    &.is-active-add {
      transition: all $v-pages-enter-animation-duration $v-pages-leave-animation-duration;
    }

    &.is-active-remove {
      position: absolute;
      width: 100%;
      top: 0;
      left: 0;
      transform: translateY(0);
      transition: all $v-pages-leave-animation-duration;
    }

    &.is-active-add,
    &.is-active-remove {
      display: block;
    }
  }
}


              
            
!

JS

              
                (function (angular) {
  'use strict';

  angular
    .module('myApp', [ 'ngAnimate', 'ngSanitize', 'vTabs' ])

    .controller('MainController', function ($scope) {

      $scope.simpleTabs = {
        active: 0
      };

      $scope.simplePages = {
        active: 0
      };

      $scope.verticalTabs = {
        active: 0
      };

      $scope.horizontalTabs = {
        active: 0
      };

      $scope.pages = [
        {
          id: 1,
          title: 'Tab 1',
          content: '<h4>Page 1</h4><p>Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.</p>'
        },
        {
          id: 2,
          title: 'Tab 2',
          content: '<h4>Page 2</h4><p>Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor.</p>'
        },
        {
          id: 3,
          title: 'Tab 3',
          content: '<h4>Page 3</h4><p>Pellentesque facilisis. Nulla imperdiet sit amet magna. Vestibulum dapibus, mauris nec malesuada fames ac turpis velit, rhoncus eu, luctus et interdum adipiscing wisi.</p>'
        }
      ];
    });

})(angular);

              
            
!
999px

Console