Buttons

The classic button, in different colors, sizes, and states

Colors Yes
Sizes Yes
Variables Yes

The button is an essential element of any design. It's meant to look and behave as an interactive element of your page.

<a class="button">Button</a>

The .button class can be used on:

  • <a> anchor links
  • <button> form buttons
  • <input type="submit"> submit inputs
  • <input type="reset"> reset inputs
Anchor
<a class="button">Anchor</a>
<button class="button">Button</button>
<input class="button" type="submit" value="Submit input">
<input class="button" type="reset" value="Reset input">

Colors #

There are several style modifiers available. Just add one of the following classes to apply a different look.

<button class="button is-default">Default</button>
<button class="button is-primary">Primary</button>
<button class="button is-secondary">Secondary</button>
<button class="button is-danger">Danger</button>
<button class="button is-text">Text</button>
<button class="button is-link">Link</button>

Sizes #

<a class="button is-small">Small</a>
<a class="button">Normal</a>
<a class="button is-medium">Medium</a>
<a class="button is-large">Large</a>

Styles #

Outlined

<a class="button is-primary is-outlined">Primary</a>
<a class="button is-secondary is-outlined">Secondary</a>
<a class="button is-danger is-outlined">Danger</a>

Inverted (the text color becomes the background color, and vice-versa)

<a class="button is-primary is-inverted">Primary</a>
<a class="button is-secondary is-inverted">Secondary</a>
<a class="button is-danger is-inverted">Danger</a>

Invert Outlined (the invert color becomes the text and border colors)

<a class="button is-primary is-inverted is-outlined">Primary</a>
<a class="button is-secondary is-inverted is-outlined">Secondary</a>
<a class="button is-danger is-inverted is-outlined">Danger</a>

Rounded buttons

New! 1.3.3
<a class="button is-rounded">Rounded</a>
<a class="button is-primary is-rounded">Rounded</a>
<a class="button is-info is-rounded">Rounded</a>
<a class="button is-success is-rounded">Rounded</a>
<a class="button is-danger is-rounded">Rounded</a>

States #

Normal

<p class="field">
  <a class="button">Normal</a>
  <a class="button is-primary">Normal</a>
  <a class="button is-secondary">Normal</a>
</p>
<p class="field">
  <a class="button is-success">Normal</a>
  <a class="button is-warning">Normal</a>
  <a class="button is-danger">Normal</a>
</p>

Hover

<p class="field">
  <a class="button is-hovered">Hover</a>
  <a class="button is-hovered is-primary">Hover</a>
  <a class="button is-hovered is-secondary">Hover</a>
</p>
<p class="field">
  <a class="button is-hovered is-success">Hover</a>
  <a class="button is-hovered is-warning">Hover</a>
  <a class="button is-hovered is-danger">Hover</a>
</p>

Focus

<p class="field">
  <a class="button is-focused">Focus</a>
  <a class="button is-focused is-primary">Focus</a>
  <a class="button is-focused is-secondary">Focus</a>
</p>
<p class="field">
  <a class="button is-focused is-success">Focus</a>
  <a class="button is-focused is-warning">Focus</a>
  <a class="button is-focused is-danger">Focus</a>
</p>

Active

<p class="field">
  <a class="button is-active">Active</a>
  <a class="button is-active is-primary">Active</a>
  <a class="button is-active is-secondary">Active</a>
</p>
<p class="field">
  <a class="button is-active is-success">Active</a>
  <a class="button is-active is-warning">Active</a>
  <a class="button is-active is-danger">Active</a>
</p>

Loading

Since the loading spinner is implemented using the :after pseudo-element, it is not supported by the <input type="submit"> element.

<p class="field">
  <a class="button is-loading">Loading</a>
  <a class="button is-loading is-primary">Loading</a>
  <a class="button is-loading is-secondary">Loading</a>
</p>
<p class="field">
  <a class="button is-loading is-success">Loading</a>
  <a class="button is-loading is-warning">Loading</a>
  <a class="button is-loading is-danger">Loading</a>
</p>

Static

You can create a non-interactive button by using the is-static modifier. This is useful to align a text label with an input, for example when using form addons.

Static
<span class="button is-static">Static</span>

Disabled

The is-disabled CSS class has been deprecated in favor of the disabled HTML attribute.

<p class="field">
  <a class="button" title="Disabled button" disabled>Disabled</a>
  <a class="button is-primary" title="Disabled button" disabled>Disabled</a>
  <a class="button is-secondary" title="Disabled button" disabled>Disabled</a>
</p>
<p class="field">
  <a class="button is-success" title="Disabled button" disabled>Disabled</a>
  <a class="button is-warning" title="Disabled button" disabled>Disabled</a>
  <a class="button is-danger" title="Disabled button" disabled>Disabled</a>
</p>

With Font Awesome icons

<p class="field">
  <a class="button">
    <span class="icon is-small">
      <i class="fas fa-bold"></i>
    </span>
  </a>
  <a class="button">
    <span class="icon is-small">
      <i class="fas fa-italic"></i>
    </span>
  </a>
  <a class="button">
    <span class="icon is-small">
      <i class="fas fa-underline"></i>
    </span>
  </a>
</p>
<p class="field">
  <a class="button is-primary">
    <span class="icon">
      <i class="fab fa-twitter"></i>
    </span>
    <span>Twitter</span>
  </a>
  <a class="button is-success">
    <span class="icon is-small">
      <i class="fas fa-check"></i>
    </span>
    <span>Save</span>
  </a>
  <a class="button is-danger is-outlined">
    <span>Delete</span>
    <span class="icon is-small">
      <i class="fas fa-times"></i>
    </span>
  </a>
</p>
<p class="field">
  <a class="button is-small">
    <span class="icon is-small">
      <i class="fab fa-github"></i>
    </span>
    <span>GitHub</span>
  </a>
  <a class="button">
    <span class="icon">
      <i class="fab fa-github"></i>
    </span>
    <span>GitHub</span>
  </a>
  <a class="button is-medium">
    <span class="icon">
      <i class="fab fa-github"></i>
    </span>
    <span>GitHub</span>
  </a>
  <a class="button is-large">
    <span class="icon is-medium">
      <i class="fab fa-github"></i>
    </span>
    <span>GitHub</span>
  </a>
</p>

If the button only contains an icon, Elenore will make sure the button remains square, no matter the size of the button or of the icon.

<p class="field">
  <a class="button is-small">
    <span class="icon is-small">
      <i class="fas fa-heading"></i>
    </span>
  </a>
</p>
<p class="field">
  <a class="button">
    <span class="icon is-small">
      <i class="fas fa-heading"></i>
    </span>
  </a>
  <a class="button">
  <span class="icon">
    <i class="fas fa-heading fa-lg"></i>
  </span>
  </a>
</p>
<p class="field">
  <a class="button is-medium">
    <span class="icon is-small">
      <i class="fas fa-heading"></i>
    </span>
  </a>
  <a class="button is-medium">
  <span class="icon">
    <i class="fas fa-heading fa-lg"></i>
  </span>
  </a>
  <a class="button is-medium">
    <span class="icon is-medium">
      <i class="fas fa-heading fa-2x"></i>
    </span>
  </a>
</p>
<p class="field">
  <a class="button is-large">
    <span class="icon is-small">
      <i class="fas fa-heading"></i>
    </span>
  </a>
  <a class="button is-large">
  <span class="icon">
    <i class="fas fa-heading fa-lg"></i>
  </span>
  </a>
  <a class="button is-large">
    <span class="icon is-medium">
      <i class="fas fa-heading fa-2x"></i>
    </span>
  </a>
</p>

Button group #

If you want to group buttons together on a single line, use the is-grouped modifier on the field container:

<div class="field is-grouped">
  <p class="control">
    <a class="button is-link">
      Save changes
    </a>
  </p>
  <p class="control">
    <a class="button">
      Cancel
    </a>
  </p>
  <p class="control">
    <a class="button is-danger">
      Delete post
    </a>
  </p>
</div>

Button addons #

If you want to use buttons as addons, use the has-addons modifier on the field container:

<div class="field has-addons">
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-align-left"></i>
      </span>
      <span>Left</span>
    </a>
  </p>
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-align-center"></i>
      </span>
      <span>Center</span>
    </a>
  </p>
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-align-right"></i>
      </span>
      <span>Right</span>
    </a>
  </p>
</div>

Button group with addons #

You can group together addons as well:

<div class="field has-addons">
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-bold"></i>
      </span>
      <span>Bold</span>
    </a>
  </p>
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-italic"></i>
      </span>
      <span>Italic</span>
    </a>
  </p>
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-underline"></i>
      </span>
      <span>Underline</span>
    </a>
  </p>
</div>

<div class="field has-addons">
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-align-left"></i>
      </span>
      <span>Left</span>
    </a>
  </p>
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-align-center"></i>
      </span>
      <span>Center</span>
    </a>
  </p>
  <p class="control">
    <a class="button">
      <span class="icon is-small">
        <i class="fas fa-align-right"></i>
      </span>
      <span>Right</span>
    </a>
  </p>
</div>

List of buttons #

You can now create a list of buttons with the .buttons container.

Save changes Save and continue Cancel
<div class="buttons">
  <span class="button is-success">Save changes</span>
  <span class="button is-info">Save and continue</span>
  <span class="button is-danger">Cancel</span>
</div>

If the list is very long, it will automatically wrap on multiple lines, while keeping all buttons evenly spaced.

One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen Sixteen Seventeen Eighteen Nineteen Twenty
<div class="buttons">
  <span class="button">One</span>
  <span class="button">Two</span>
  <span class="button">Three</span>
  <span class="button">Four</span>
  <span class="button">Five</span>
  <span class="button">Six</span>
  <span class="button">Seven</span>
  <span class="button">Eight</span>
  <span class="button">Nine</span>
  <span class="button">Ten</span>
  <span class="button">Eleven</span>
  <span class="button">Twelve</span>
  <span class="button">Thirteen</span>
  <span class="button">Fourteen</span>
  <span class="button">Fifteen</span>
  <span class="button">Sixteen</span>
  <span class="button">Seventeen</span>
  <span class="button">Eighteen</span>
  <span class="button">Nineteen</span>
  <span class="button">Twenty</span>
</div>

You can attach buttons together with the .has-addons modifier.

Yes Maybe No
<div class="buttons has-addons">
  <span class="button">Yes</span>
  <span class="button">Maybe</span>
  <span class="button">No</span>
</div>

Use the is-centered or the is-right modifiers to alter the alignment.

Yes Maybe No
Yes Maybe No
<div class="buttons has-addons is-centered">
  <span class="button">Yes</span>
  <span class="button">Maybe</span>
  <span class="button">No</span>
</div>

<div class="buttons has-addons is-right">
  <span class="button">Yes</span>
  <span class="button">Maybe</span>
  <span class="button">No</span>
</div>

You can use any modifier class on each button to differentiate them. Make sure to add the is-selected modifier as well to make sure the selected button is above its siblings.

Yes Maybe No
Yes Maybe No
Yes Maybe No
<div class="buttons has-addons">
  <span class="button is-success is-selected">Yes</span>
  <span class="button">Maybe</span>
  <span class="button">No</span>
</div>

<div class="buttons has-addons">
  <span class="button">Yes</span>
  <span class="button is-info is-selected">Maybe</span>
  <span class="button">No</span>
</div>

<div class="buttons has-addons">
  <span class="button">Yes</span>
  <span class="button">Maybe</span>
  <span class="button is-danger is-selected">No</span>
</div>

Difference between form groups and list of buttons

While this list of buttons style can be achieved with either field is-grouped or the new buttons class, there are a few differences:

  • buttons has a simpler markup
  • buttons can only contain button elements
  • field is-grouped can contain any type of control inputs
  • field is-grouped can be forced to fit all controls on a single line
  • with field is-grouped you can expand one of the controls

Basically, if you only want a list of buttons, using buttons is recommended. If you need more control on the styling and the elements, use a form group.


Variables #

You can use these variables to customize this element. Simply set one or multiple of these variables before importing Elenore. Learn how.

Name Default value
Name Default value
$button-color $grey-darker
$button-background-color $white
$button-border-color $grey-lighter
$button-border-width $control-border-width
$button-padding-vertical calc(0.375em - #{$button-border-width})
$button-padding-horizontal 0.75em
$button-hover-color $link-hover
$button-hover-border-color $link-hover-border
$button-focus-color $link-focus
$button-focus-border-color $link-focus-border
$button-focus-box-shadow-size 0 0 0 0.125em
$button-focus-box-shadow-color rgba($link, 0.25)
$button-active-color $link-active
$button-active-border-color $link-active-border
$button-text-color $text
$button-text-hover-background-color $background
$button-text-hover-color $text-strong
$button-disabled-background-color $white
$button-disabled-border-color $grey-lighter
$button-disabled-shadow none
$button-disabled-opacity 0.5
$button-static-color $grey
$button-static-background-color $white-ter
$button-static-border-color $grey-lighter

This page is open source. View on GitHub