Shards

Documentation

Buttons

Last updated: February 8, 2018

Shards improves the core button styles available in Bootstrap by adding extra utility classes for extended control.

The .btn class is intended to be applied mainly to <button>s, but it can be used with anything including anchors, button input types, submit buttons or even reset inputs.

<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>

Outline Buttons

Outline buttons are also available and improved for better acessibility.

<button type="button" class="btn btn-outline-primary">Primary</button>
<button type="button" class="btn btn-outline-secondary">Secondary</button>
<button type="button" class="btn btn-outline-success">Success</button>
<button type="button" class="btn btn-outline-danger">Danger</button>
<button type="button" class="btn btn-outline-warning">Warning</button>
<button type="button" class="btn btn-outline-info">Info</button>
<button type="button" class="btn btn-outline-light">Light</button>
<button type="button" class="btn btn-outline-dark">Dark</button>

Pill Shaped Buttons

To create pill shaped buttons you can use the .btn-pill utility class.

  <!-- Normal Buttons -->
  <button type="button" class="btn btn-primary btn-pill">Primary</button>
  <button type="button" class="btn btn-secondary btn-pill">Secondary</button>
  <button type="button" class="btn btn-success btn-pill">Success</button>
  <button type="button" class="btn btn-danger btn-pill">Danger</button>
  <button type="button" class="btn btn-warning btn-pill">Warning</button>
  <button type="button" class="btn btn-info btn-pill">Info</button>
  <button type="button" class="btn btn-light btn-pill">Light</button>
  <button type="button" class="btn btn-dark btn-pill">Dark</button>

  <!-- Outlined Buttons -->
  <button type="button" class="btn btn-outline-primary btn-pill">Primary</button>
  <button type="button" class="btn btn-outline-secondary btn-pill">Secondary</button>
  <button type="button" class="btn btn-outline-success btn-pill">Success</button>
  <button type="button" class="btn btn-outline-danger btn-pill">Danger</button>
  <button type="button" class="btn btn-outline-warning btn-pill">Warning</button>
  <button type="button" class="btn btn-outline-info btn-pill">Info</button>
  <button type="button" class="btn btn-outline-light btn-pill">Light</button>
  <button type="button" class="btn btn-outline-dark btn-pill">Dark</button>

Squared Buttons

Similarly you can also use the .btn-squared class to remove the border radius completely.

  <!-- Normal Buttons -->
  <button type="button" class="btn btn-primary btn-squared">Primary</button>
  <button type="button" class="btn btn-secondary btn-squared">Secondary</button>
  <button type="button" class="btn btn-success btn-squared">Success</button>
  <button type="button" class="btn btn-danger btn-squared">Danger</button>
  <button type="button" class="btn btn-warning btn-squared">Warning</button>
  <button type="button" class="btn btn-info btn-squared">Info</button>
  <button type="button" class="btn btn-light btn-squared">Light</button>
  <button type="button" class="btn btn-dark btn-squared">Dark</button>

  <!-- Outlined Buttons -->
  <button type="button" class="btn btn-primary btn-squared">Primary</button>
  <button type="button" class="btn btn-secondary btn-squared">Secondary</button>
  <button type="button" class="btn btn-success btn-squared">Success</button>
  <button type="button" class="btn btn-danger btn-squared">Danger</button>
  <button type="button" class="btn btn-warning btn-squared">Warning</button>
  <button type="button" class="btn btn-info btn-squared">Info</button>
  <button type="button" class="btn btn-light btn-squared">Light</button>
  <button type="button" class="btn btn-dark btn-squared">Dark</button>

Button Sizes

The button sizes available in Bootstrap 4 are also available in Shards. You can change a button’s size by using either the .btn-lg or the .btn-sm class.

  <button type="button" class="btn btn-success btn-lg">Large Button</button>
  <button type="button" class="btn btn-success">Normal Button</button>
  <button type="button" class="btn btn-success btn-sm">Small button</button>

Button Groups

Using the .btn-group class on an outer wrapper allows you to create linked inline buttons.

<div class="btn-group" role="group" aria-label="Basic example">
  <button type="button" class="btn btn-danger">Left</button>
  <button type="button" class="btn btn-danger">Middle</button>
  <button type="button" class="btn btn-danger">Right</button>
</div>

The .btn and .btn-group styles can be applied to more than just <button>s. Using checkboxes and radio buttons you can create button groups that can be toggled on or off.

<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary active" for="option1">
    <input type="radio" name="btnGroupOption1" id="option1" autocomplete="off" checked=""> Radio 1 (checked)
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="btnGroupOption1" id="option2" autocomplete="off"> Radio 2
  </label>
  <label class="btn btn-primary" for="option3">
    <input type="radio" name="btnGroupOption1" id="option3" autocomplete="off"> Radio 3
  </label>
</div>

Similarly, the same effect can be achieved using checkboxes instead of radio buttons.

<div class="btn-group btn-group-toggle" data-toggle="buttons">
  <label class="btn btn-primary active">
    <input type="checkbox" name="options" id="option1" autocomplete="off" checked> Active
  </label>
  <label class="btn btn-primary">
    <input type="checkbox" name="options" id="option2" autocomplete="off"> Checkbox
  </label>
  <label class="btn btn-primary">
    <input type="checkbox" name="options" id="option3" autocomplete="off"> Checkbox
  </label>
</div>