Examples of building button components for actions in forms, dialogs, and more with support for multiple sizes, states, and more

Whilst all of the following buttons can be built with utility classes, Elements ships with some pre-designed button styles to make working with these frequently used components easier.

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

Outline buttons

In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the .btn-outline-* ones to remove all background images and colors on any button.

<button type="button" class="btn btn-outline-primary my-2 mx-3">Primary</button><button type="button" class="btn btn-outline-secondary my-2 mx-3">Secondary</button><button type="button" class="btn btn-outline-info my-2 mx-3">Info</button><button type="button" class="btn btn-outline-success my-2 mx-3">Success</button><button type="button" class="btn btn-outline-warning my-2 mx-3">Warning</button><button type="button" class="btn btn-outline-danger my-2 mx-3">Danger</button><button type="button" class="btn btn-outline-light my-2 mx-3">Light</button>
<button type="button" href="#" class="btn btn-outline-primary">Primary</button>
<button type="button" href="#" class="btn btn-outline-secondary">Secondary</button>
<button type="button" href="#" class="btn btn-outline-info">Info</button>
<button type="button" href="#" class="btn btn-outline-success">Success</button>
<button type="button" href="#" class="btn btn-outline-warning">Warning</button>
<button type="button" href="#" class="btn btn-outline-danger">Danger</button>
<button type="button" href="#" class="btn btn-outline-light">Light</button>

Disable text wrapping

If you don’t want the button text to wrap, you can add the .whitespace-nowrap class to the button.

Button tags

The .btn classes are designed to be used with the <button> element. However, you can also use these classes on <a> or <input> elements (though some browsers may apply a slightly different rendering).

When using button classes on <a> elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given a role=“button” to appropriately convey their purpose to assistive technologies such as screen readers.

<a class="btn btn-info" href="#" role="button">Link</a>
<button class="btn btn-info" type="submit">Button</button>
<input class="btn btn-info" type="button" value="Input">
<input class="btn btn-info" type="submit" value="Submit">
<input class="btn btn-info" type="reset" value="Reset">


Add.btn-xs, .btn-sm, .btn-md, .btn-lg or .btn-xl for additional sizes. Omitting the size modifier will use .btn-md as the default size.

<button type="button" class="btn btn-success btn-xs my-2 mx-3">Extra small</button><button type="button" class="btn btn-success btn-sm my-2 mx-3">Small</button><button type="button" class="btn btn-success btn-md my-2 mx-3">Medium</button><button type="button" class="btn btn-success btn-lg my-2 mx-3">Large</button><button type="button" class="btn btn-success btn-xl my-2 mx-3">Extra large</button>
<button type="button" class="btn btn-success btn-xs">Extra small</button>
<button type="button" class="btn btn-success btn-sm">Small</button>
<button type="button" class="btn btn-success btn-md">Medium</button>
<button type="button" class="btn btn-success btn-lg">Large</button>
<button type="button" class="btn btn-success btn-xl">Extra large</button>

Create block level buttons—those that span the full width of a parent—by adding .btn-block.

<button type="button" class="btn btn-warning btn-lg justify-center w-full">Block</button>
<button type="button" class="btn btn-outline-warning btn-lg justify-center w-full">Block</button>

Active State

Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. There’s no need to add a class to <button>s as they use a pseudo-class. However, you can still force the same active appearance with .active (and include the aria-pressed="true" attribute) should you need to replicate the state programmatically.

<button class="btn btn-primary active my-2 mx-3" type="button" aria-pressed="true">Primary</button><button class="btn btn-secondary active my-2 mx-3" type="button" aria-pressed="true">Secondary</button><button class="btn btn-info active my-2 mx-3" type="button" aria-pressed="true">Info</button><button class="btn btn-success active my-2 mx-3" type="button" aria-pressed="true">Success</button><button class="btn btn-warning active my-2 mx-3" type="button" aria-pressed="true">Warning</button><button class="btn btn-danger active my-2 mx-3" type="button" aria-pressed="true">Danger</button><button class="btn btn-light active my-2 mx-3" type="button" aria-pressed="true">Light</button>
<a href="#" class="btn btn-primary" role="button" aria-pressed="true">Primary</a>
<a href="#" class="btn btn-secondary" role="button" aria-pressed="true">Secondary</a>
<a href="#" class="btn btn-info" role="button" aria-pressed="true">Info</a>
<a href="#" class="btn btn-success" role="button" aria-pressed="true">Success</a>
<a href="#" class="btn btn-warning" role="button" aria-pressed="true">Warning</a>
<a href="#" class="btn btn-danger" role="button" aria-pressed="true">Danger</a>
<a href="#" class="btn btn-light" role="button" aria-pressed="true">Light</a>

Disabled state

Make buttons look inactive by adding the disabled boolean attribute to any <button> element.

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

Buttons with icons

The button components use SVG’s for icons. .btn-{xs,sm,md,lg,xl} classes automatically set the default icon size. It can be modified using the .icon-* utility classes, check out the Icon Size documentation.

When spacing button content use .inline-xs for .btn-xs & .btn-sm, and .inline-sm for btn, ..btn-md, .btn-lg & .btn-xl.

<!-- Icon left -->
<a role="button" href="#" class="btn btn-danger btn-{size} ...">
<svg class="icon icon--account-circle inline-{xs, sm}" role="img" fill="currentColor" aria-hidden="true" width="24" height="24" viewBox="0 0 24 24"><use xlink:href="/assets/img/sprite.svg#icon-account-circle"></use></svg>
<!-- Icon right -->
<a role="button" href="#" class="btn btn-danger btn-{size} ...">
<svg class="icon icon--account-circle inline-l-{xs, sm}" role="img" fill="currentColor" aria-hidden="true" width="24" height="24" viewBox="0 0 24 24"><use xlink:href="/assets/img/sprite.svg#icon-account-circle"></use></svg>

Buttons Styles

There are four types of buttons that come baked into Elements CSS, .btn, .btn-square, .btn-rounded and .btn-link.

<button class="btn btn-primary btn-md btn- my-2 mx-3">
<svg class="icon icon--account-circle inline-sm" role="img" fill="currentColor" aria-hidden="true" width="24" height="24" viewBox="0 0 24 24"><use xlink:href="/assets/img/sprite.svg#icon-account-circle"></use></svg>