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.


                button.btn.btn-primary.js-modal-trigger(type="button" data-target="#myModal") test modal

button.btn.btn-success.js-alert-trigger(type="button") test alert

    p this is the alert yo
    button.close.btn.btn-close.js-force-close <span>&times;</span>

<!-- Modal -->
#myModal.modal.fade.js-modal(tabindex="-1" role="dialog" aria-labelledby="myModalLabel")
        button.close(type="button" data-dismiss="modal" aria-label="Close") <span aria-hidden="true">&times;</span>
        h4#myModalLabel.modal-titleModal title
      .modal-body ...
        button.btn.btn-default(type="button" data-dismiss="modal") Close
        button.btn.btn-primary(type="button") Save changes



.alert {
  padding-right: 40px;
  .close {
    padding: 10px;
    position: absolute;
    right: 0;
    top: 0;

.alert-dismissable-group {
  bottom: 15px;
  left: 15px;
  position: fixed;

.alert-dismissable {
  opacity: 0;
  transform: translateY(100%);
  transition: opacity .3s ease-out, transform .01s linear .3s;
  &.is-shown {
    opacity: 1;
    transform: translateY(0);
    transition: all .3s ease-out;

body {
  min-height: 100vh;
  padding: 2rem;

* {
  &, &:before, &:after {
    box-sizing: border-box;
    &, &:focus, &:active, &:focus:active {
      outline: none;



var autoCloseTimeout;

$('.js-alert').on('click', '.js-force-close', function(e) {

// modal example
$('.js-modal-trigger').on('click', function(e) {
    target: $('.js-modal'),
    timeout: 2000

// alert example
$('.js-alert-trigger').on('click', function(e) {
    contextual: 'danger',
    target: $('.js-alert'),
    timeout: 2000

* Function to auto close alerts and modals
* Available Options:
*   target(required) [object] - the element to be triggered with an auto close timeout
*   timeout [number] - the number of milliseconds to keep the element open before closing
*   contextual [string] - for alerts, the contextual name to apply to the alert (success, danger, info, warning)
* Note: if content is updated via JS, it must be done prior to calling this function
function autoClose(options) { // eslint-disable-line
  // set defaults
  const defaults = {
    contextual: 'success',
    timeout: 4000
  // apply options
  const $obj =;
  const contextual = options.contextual || defaults.contextual;
  const timeout = options.timeout || defaults.timeout;
  let type = 'modal';

  if ($obj.hasClass('alert')) {
    type = 'alert';
    $obj.removeClass('alert-danger alert-info alert-success alert-warning').addClass('alert-' + contextual);

  // trigger modal or show alert
  type === 'modal' ? $obj.modal('show') : $obj.addClass('is-shown');

  clearTimeout(autoCloseTimeout); // eslint-disable-line

  autoCloseTimeout = setTimeout(function() { // eslint-disable-line
    type === 'modal' ? $obj.modal('hide') : $obj.removeClass('is-shown');
  }, timeout);