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 ng-controller="AppCtrl" class="sample tabsdemoDynamicTabs" layout="column" ng-app="MyApp">
  <md-content class="md-padding">
    <md-tabs md-selected="selectedIndex" md-border-bottom="">
      <md-tab ng-repeat="tab in tabs" ng-disabled="tab.disabled" label="{{tab.title}}">
        <div class="demo-tab tab{{$index%4}}" style="padding: 25px; text-align: center;">
          <div ng-bind="tab.content"></div>
          <md-button class="md-primary md-raised" ng-click="removeTab( tab )" ng-disabled="tabs.length <= 1">Remove Tab</md-button>

  <form ng-submit="addTab(tTitle,tContent)" layout="column" class="md-padding" style="padding-top: 0;">
    <div layout="row" layout-sm="column">
      <div flex="" style="position: relative;">
        <h2 class="md-subhead" style="position: absolute; bottom: 0; left: 0; margin: 0; font-weight: 500; text-transform: uppercase; line-height: 35px; white-space: nowrap;">Add a new Tab:</h2>
        <label for="label">Label</label>
        <input type="text" id="label" ng-model="tTitle">
        <label for="content">Content</label>
        <input type="text" id="content" ng-model="tContent">
      <md-button class="add-tab md-primary md-raised" ng-disabled="!tTitle || !tContent" type="submit" style="margin-right: 0;">Add Tab</md-button>



                .tabsdemoDynamicTabs md-content {
  background-color: transparent !important; }
  .tabsdemoDynamicTabs md-content md-tabs {
    border: 1px solid #e1e1e1; }
    .tabsdemoDynamicTabs md-content md-tabs md-tab-content {
      background: #f6f6f6; }
    .tabsdemoDynamicTabs md-content md-tabs md-tabs-canvas {
      background: white; }
  .tabsdemoDynamicTabs md-content h1:first-child {
    margin-top: 0; }
.tabsdemoDynamicTabs md-input-container {
  padding-bottom: 0; }
.tabsdemoDynamicTabs .remove-tab {
  margin-bottom: 40px; }
.tabsdemoDynamicTabs .demo-tab > div > div {
  padding: 25px;
  box-sizing: border-box; }
.tabsdemoDynamicTabs .edit-form input {
  width: 100%; }
.tabsdemoDynamicTabs md-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12); }
.tabsdemoDynamicTabs md-tab[disabled] {
  opacity: 0.5; }
.tabsdemoDynamicTabs label {
  text-align: left; }
.tabsdemoDynamicTabs .long > input {
  width: 264px; }
.tabsdemoDynamicTabs .md-button.add-tab {
  transform: translateY(5px); }



                (function () {
  'use strict';
      .controller('AppCtrl', AppCtrl);

  function AppCtrl ($scope, $log) {
    var tabs = [
          { title: 'One', content: "Tabs will become paginated if there isn't enough room for them."},
          { title: 'Two', content: "You can swipe left and right on a mobile device to change tabs."},
          { title: 'Three', content: "You can bind the selected tab via the selected attribute on the md-tabs element."},
          { title: 'Four', content: "If you set the selected tab binding to -1, it will leave no tab selected."},
          { title: 'Five', content: "If you remove a tab, it will try to select a new one."},
          { title: 'Six', content: "There's an ink bar that follows the selected tab, you can turn it off if you want."},
          { title: 'Seven', content: "If you set ng-disabled on a tab, it becomes unselectable. If the currently selected tab becomes disabled, it will try to select the next tab."},
          { title: 'Eight', content: "If you look at the source, you're using tabs to look at a demo for tabs. Recursion!"},
          { title: 'Nine', content: "If you set md-theme=\"green\" on the md-tabs element, you'll get green tabs."},
          { title: 'Ten', content: "If you're still reading this, you should just go check out the API docs for tabs!"}
        selected = null,
        previous = null;
    $scope.tabs = tabs;
    $scope.selectedIndex = 2;
    $scope.$watch('selectedIndex', function(current, old){
      previous = selected;
      selected = tabs[current];
      if ( old && (old != current)) $log.debug('Goodbye ' + previous.title + '!');
      if ( current )                $log.debug('Hello ' + selected.title + '!');
    $scope.addTab = function (title, view) {
      view = view || title + " Content View";
      tabs.push({ title: title, content: view, disabled: false});
    $scope.removeTab = function (tab) {
      var index = tabs.indexOf(tab);
      tabs.splice(index, 1);