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. 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

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

              
                <link href="https://fonts.googleapis.com/css?family=Fira+Sans:200,400,600,700|Merriweather:300,400,700" rel="stylesheet">
<div class="ui container">
  <!-- Following Menu-->
  <div class="ui form">
    <h1 class="ui dividing header">Toggles</h1>
    <div class="field">
      <div class="ui first toggle checked checkbox">
        <input type="checkbox" checked="" />
        <span data-on="ON" data-off="OFF"></span>
        <label>{Label} Enabled</label>
      </div>
    </div>
    <div class="field">
      <div class="ui first toggle checkbox">
        <input type="checkbox" />
        <span data-on="ON" data-off="OFF"></span>
        <label>{Label} Enabled</label>
      </div>
    </div>
    <div class="field">
      <div class="ui second toggle checkbox checked">
        <input type="checkbox" checked="" disabled><span data-on="ON" data-off="OFF"></span>
        <label>{Label} Disabled ON</label>
      </div>

    </div>
    <div class="field">
      <div class="ui second toggle checkbox">
        <input type="checkbox" disabled><span data-on="ON" data-off="OFF"></span>
        <label>{Label} Disabled OFF</label>
      </div>

    </div>
    <h1 class="ui dividing header">Dropdowns</h1>
    <div class="field">
      <label>Device source (pre-selected)</label>
      <select name="input" class="ui input dropdown">
            <option value="av">AV</option>
            <option value="hdmi">HDMI</option>
            <option value="vga">VGA</option>
            <option value="tv" selected="">TV</option>
          </select>
    </div>

    <div class="field">
      <label>Dog Breed (selection with hint text)</label>
      <div class="ui selection input dropdown">
        <div class="default text">- Select -</div>
        <i class="dropdown icon"></i>
        <input type="hidden" name="gender">
        <div class="menu">
          <div class="item" data-value="doge">Shiba Inu</div>
          <div class="item" data-value="corgi">Corgi</div>
          <div class="item" data-value="husky">Husky</div>
          <div class="item" data-value="mutt">Mutt</div>
        </div>
      </div>
      <div class="hint">Choose the cutest breed</div>
    </div>

    
    <div class="field error">
      <label>Gender (mandatory)</label>
      <div class="ui selection input dropdown">
        <div class="default text">- Select -</div>
        <i class="dropdown icon"></i>
        <input type="hidden" name="gender">
        <div class="menu">
          <div class="item" data-value="male">Male</div>
          <div class="item" data-value="female">Female</div>
        </div>
      </div>
      <div class="error-hint"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Please make a selection</div>
    </div>

    <div class="field">
      <label>Disabled Drop</label>
      <select name="decoder" class="ui decoder dropdown disabled" tabindex="-1">
            <option value="1">First</option>
            <option value="2" disabled>Second</option>
            <option value="3">Third</option>
            <option value="4" selected="">Fourth</option>
          </select>
    </div>
  </div>
</div>
              
            
!

CSS

              
                $color-primary: #30267d;
$color-white: #ffffff;
$color-grey-darken-2: #212121;
$color-primary-dark-2: #1a1541;
$color-primary-dark-2_40: rgba(26, 21, 65, 0.4);
$color-primary-light-1: #aba6cb;
$color-primary-inactive: #5a5280;
$color-grey-lighten-5: #f1f1f1;
$color-primary-light-2: #4539a1;
$color-accent-dark: #04857F;
$color-accent-dark-2: #036650;
$color-accent-dark-2_40: rgba(3, 102, 40, 0.4);
$color-icon: #4388BF;
$color-icon-dark-1: #155486;
$color-icon-dark-2: #02466F;
$color-grey: #555555;
$color-grey-darken-1: #3a3a3a;
$color-grey-lighten: #727272;
$color-grey-lighten-3: #CBCBCB;
$color-grey-lighten-4: #DEDEDE;
$color-primary: #30267d;
$color-error: #DB2827;

* {
  font-size: 16px;
}
body {
  font-family: "Fira Sans", sans-serif;
  font-size: 16px;
  padding: 0;
  margin: 4em 0;
}
h1 {
  font-family: "Merriweather", serif;
  -webkit-font-smoothing: antialiased;
  font-size: 36px;
  margin-top: 0;
}
.ui.toggle.checkbox {
  font-size: 16px;
  label {
   padding-top: 0.5em;
    &:hover {
      &:before {
        background-color: $color-grey-lighten-3;
      }
    }
  }
  input {
    width: 5em;
    height: 2em;
    &:not(:checked) + span {
      color: $color-grey-darken-2;
    }
    &:checked {
      &~.box, &~label {
        &:after {
          left: 3.25em;
        }
        &:before {
          background-color: $color-primary !important;
        }
      }
    }
    &:focus {
      &~.box, &~label {
          &:before {
        box-shadow: 0px 0px 6px 1px $color-primary;
        }
      }
      &:checked {
        &~.box, &~label {
          &:before {
            background-color: $color-primary !important;        
          }
        }
      }
      ~.box, ~label {
        &:before {
          background-color: $color-grey-lighten-3;
        }
      }
    }
    ~.box, ~label {
      &:after {
        left: 0.35em;
        z-index: 3;
      }
    }
    &[disabled]{
      ~ label {
        color: $color-grey-lighten;
        cursor: not-allowed;
        &:before {
          background-color: $color-grey-lighten-4;
        }
      }
      &:not(checked) {
        + span {
          color: $color-grey-lighten;
        }
      }
      &:checked {
        + span {
          color: $color-grey-lighten-4;
        }
        ~label {
          color: $color-grey-lighten !important;
          &:before {
            background-color: $color-primary-inactive !important;
          }
        }
      }
    }
  }
  .box {
    &:hover {
      &:before {
        background-color: $color-grey-lighten-3;
      }
    }
  }
  .box, label {
    min-height: 2em;
    padding-left: 5.5em;
    &:before {
      width: 4.5em;
      height: 1.95em;
      background-color: $color-grey-lighten-4;
    }
    &:after {
      position: absolute;
      width: 1.5em;
      height: 1.5em;
      top: 0.35em;
    }
  }
}

.ui.checkbox input[disabled]~.box:after, .ui.checkbox input[disabled]~label, .ui.disabled.checkbox .box:after, .ui.disabled.checkbox label {
  opacity: 1;
}

input[type="checkbox"]{
  + span {
    display: block;
    position: absolute;
    z-index: 2;
    line-height: 2em;
    font-weight: 700;
    -webkit-font-smoothing: antialiased;
    transition: color 300ms ease-in-out;
  }    
    // Off
    &:not(:checked) {
      + span {
        color: $color-grey-darken-2;
        left: 2.25em;
        &:before {
          content: attr(data-off);
        }
        &:after {
          left: 1.6em;
        }
      }
      &:disabled {
        cursor: not-allowed;
        + span {
          color: $color-grey-lighten;
          cursor: not-allowed;
        }
      }
    }

    // On
    &:checked {
      + span {
        color: $color-white;
        left: 0.5em;
        &:before {
          content: attr(data-on);
        }
        &:after {
          left: 100%;
        }
      }
      &:disabled {
        cursor: not-allowed;
        + span {
          color: $color-grey-lighten-4;
          cursor: not-allowed;
        }
      }
    }
}

/* DROPDOWNS */
.ui {
  .upward.selection.dropdown {
      .menu {
        border-radius: 0.25em;
        margin-bottom: 0.25em;
        border-bottom-width: 1px !important;
      }
      &.visible {
          border-radius: 0.3em !important;
      }
    }
  .selection {
    &.dropdown {
      .menu {
        border-radius: 0.25em;
        margin-top: 0.25em;
        border-top-width: 1px !important;
          > .item {
           border-top: 0;
            &:hover {
              background-color: $color-grey-lighten-4;
          }
        }
      }
    }
  }
  .active {
    &.selection.dropdown {
      border-bottom-left-radius: 3px!important;
      border-bottom-right-radius: 3px!important;
    }
    &.item {
      font-weight: normal;
    }
  }
  &.dropdown {
    .menu {
      .active.item {
        font-weight: normal;
      }
    }
  }
}

.ui.selection.dropdown, .ui.selection.dropdown .menu .item {
  font-size: 16px;
}
@media only screen and (min-width: 768px) {
  .ui.selection.dropdown .menu {
      max-height: 11em;
  }
}
.ui.dropdown .menu>.item {
  border: 0;
}
.ui.selection.active.dropdown:hover .menu {
  border-color: $color-grey-lighten;
}
.ui.selection.active.dropdown .menu,
.ui.selection.dropdown:hover {
  border-color: $color-primary;
}
.ui.selection.active.dropdown, .ui.selection.active.dropdown:hover,
.ui.selection.active.dropdown:focus,
.ui.selection.dropdown:focus,
.ui.selection.active.dropdown .menu:hover {
  border-color: $color-primary;
  box-shadow: 0px 0px 6px 1px $color-primary-light-1;
}
.ui.selection.dropdown {
  border: 1px solid $color-grey-lighten;
}

.ui.selection.disabled.dropdown, .ui.dropdown .menu>.disabled.item {
  opacity: 1;
  color: $color-grey-lighten;
  user-focus: none;
}
.ui.disabled.dropdown {
  border: 1px solid $color-grey-lighten;
  background-color: $color-grey-lighten-5;
  pointer-events: auto;
  cursor: not-allowed;
  select {
    pointer-events: none;
  }
  &:hover {
    border-color: $color-grey-lighten;
  }
}
.ui.dropdown .menu>.item {
  color: $color-grey-darken-2;
}
.ui.selection.dropdown {
  box-sizing: border-box;
  min-height: 2em;
  padding: 1em 1em;
  color: $color-grey-darken-2;
}
.ui.selection.dropdown .menu>.item {
  padding: 0.75em 1em !important;
}
.ui.form .field>label {
  font-size: 16px;
  color: $color-grey-darken-2;
}
.ui.selection.active.dropdown,
.ui.selection.active.dropdown:hover,
.ui.selection.active.dropdown:focus
{
  box-shadow: 0px 0px 6px 1px $color-primary-light-1;
}
.ui.form .field.error .ui.dropdown:hover, .ui.form .fields.error .field .ui.dropdown, .ui.form .fields.error .field .ui.dropdown:hover {
  border: 1px solid $color-primary !important;
}
.ui.form .fields.error .field .ui.dropdown:focus {
  border: 1px solid $color-primary !important;
}
.ui.form .field.error .ui.dropdown {
  border-color: $color-error !important;
  background-color: $color-white;
}
.ui.form .field.error .ui.dropdown .menu:hover, .ui.form .fields.error .field .ui.dropdown .menu:hover {
  border-color: $color-primary !important;
}
.ui.form .field.error .dropdown.icon,
.ui.form .field.error select
{
  color: $color-grey-darken-2;
}
.ui.form .field.error .ui.dropdown, .ui.form .field.error .ui.dropdown .item, .ui.form .field.error .ui.dropdown .text, .ui.form .fields.error .field .ui.dropdown, .ui.form .fields.error .field .ui.dropdown .item {
  color: $color-grey-darken-2;
  background-color: $color-white;
}
.error-hint {
  color: $color-error;
  font-size: 16px;
}
.ui.form .field.error .ui.dropdown:hover .menu {
  border-color: $color-grey-lighten;
}
.hint {
  font-size: 16px;
  color: $color-grey-lighten;
}
.ui.form .field.error .input, .ui.form .field.error label, .ui.form .fields.error .field .input, .ui.form .fields.error .field label {
  color: $color-grey-darken-2;
}
.ui.default.dropdown:hover > .text, .ui.default.dropdown > .text, .ui.dropdown:hover > .default.text, .ui.dropdown > .default.text {
  color: $color-grey-darken-2;
}
.ui.form .field.error .ui.dropdown .menu .active.item, .ui.form .fields.error .field .ui.dropdown .menu .active.item {
    background-color: $color-grey-lighten-5 !important;
}
.ui.form .field.error .ui.dropdown .menu .item:hover, .ui.form .field.error .ui.dropdown .menu .selected.item, .ui.form .fields.error .field .ui.dropdown .menu .item:hover, .ui.form .fields.error .field .ui.dropdown .menu .selected.item {
  background-color: $color-grey-lighten-4;
}
.ui.selection.dropdown>.dropdown.icon {
  top: 0;
  line-height: 3em;
}
.ui.default.dropdown:not(.button)>.text, .ui.dropdown:not(.button)>.default.text {
  color: $color-grey-darken-1;
}

.ui.dropdown .menu .selected.item, .ui.dropdown.selected {
  background-color: $color-grey-lighten-5;
  &:before {
    height: 2.5em;
    width: 5px;
    content: '';
    background-color: $color-accent-dark;
    padding: 2.5px;
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
  }
  &:hover {
    background-color: $color-grey-lighten-5 !important;
    cursor: default;
  }
}
              
            
!

JS

              
                        $(function(){
  
  var
  $dropdown         = $('select.dropdown'),
  $sidebar          = $('.ui.container'),
  $topMenu          = $('#fixed-menu'),
  $items            = $topMenu.find('a'),
  $itemsdata        = $items.val(),
  $inputDropdown    = $sidebar.find('.input.dropdown'),
  $decoderDropdown  = $sidebar.find('.decoder.dropdown')
  ;
  
  // dropdowns
  
  $decoderDropdown
    .dropdown({
      onChange: function(value) {
      console.log(value);  
      }
    })
  ;
  
  $inputDropdown
    .dropdown({
      onChange: function(value) {
      console.log(value);
    }
  })
  ;
});
/* MANUALLY ADD TABINDEX -1 to disabled selects!!!! SO BAD */
$(document).ready(function () {
  $(".ui.dropdown.disabled").attr("tabindex", -1);
});
              
            
!
999px

Console