Bootstrap buttons

Bootstrap buttons component for actions in tables, forms, cards, and more. Bootstrap 4 provides various styles, states, and size. Ready to use and easy to customize.

On this page:


CoreUI includes a bunch of predefined Bootstrap buttons, each serving its own semantic purpose. CoreUI also offers some unique buttons styles.

Buttons show what action will happen when the user clicks or touches it. Bootstrap buttons are used to initialize operations, both in the background or foreground of an experience.

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

<button type="button" class="c-btn c-btn-link">Link</button>
Conveying meaning to assistive technologies

Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.

With icons

You can combine Bootstrap buttons with our CoreUI Icons.

<button type="button" class="c-btn c-btn-primary"><span class="cui-contrast c-btn-icon c-mr-2"></span> Primary</button>
<button type="button" class="c-btn c-btn-secondary"><span class="cui-contrast c-btn-icon c-mr-2"></span> Secondary</button>
<button type="button" class="c-btn c-btn-success"><span class="cui-contrast c-btn-icon c-mr-2"></span> Success</button>
<button type="button" class="c-btn c-btn-danger"><span class="cui-contrast c-btn-icon c-mr-2"></span> Danger</button>
<button type="button" class="c-btn c-btn-warning"><span class="cui-contrast c-btn-icon c-mr-2"></span> Warning</button>
<button type="button" class="c-btn c-btn-info"><span class="cui-contrast c-btn-icon c-mr-2"></span> Info</button>
<button type="button" class="c-btn c-btn-light"><span class="cui-contrast c-btn-icon c-mr-2"></span> Light</button>
<button type="button" class="c-btn c-btn-dark"><span class="cui-contrast c-btn-icon c-mr-2"></span> Dark</button>

<button type="button" class="c-btn c-btn-link">Link</button>

Brand buttons

You can also combine Bootstrap buttons with Brand Icons.

<button type="button" class="c-btn c-btn-behance"><span class="fab fa-behance c-btn-icon c-mr-2"></span> Behance</button>
<button type="button" class="c-btn c-btn-dribbble"><span class="fab fa-dribbble c-btn-icon c-mr-2"></span> Dribbble</button>
<button type="button" class="c-btn c-btn-facebook"><span class="fab fa-facebook c-btn-icon c-mr-2"></span> Facebook</button>
<button type="button" class="c-btn c-btn-flickr"><span class="fab fa-flickr c-btn-icon c-mr-2"></span> Flickr</button>
<button type="button" class="c-btn c-btn-github"><span class="fab fa-github c-btn-icon c-mr-2"></span> Github</button>
<button type="button" class="c-btn c-btn-instagram"><span class="fab fa-instagram c-btn-icon c-mr-2"></span> Instagram</button>
<button type="button" class="c-btn c-btn-linkedin"><span class="fab fa-linkedin c-btn-icon c-mr-2"></span> Linkedin</button>
<button type="button" class="c-btn c-btn-pinterest"><span class="fab fa-pinterest c-btn-icon c-mr-2"></span> Pinterest</button>
<button type="button" class="c-btn c-btn-reddit"><span class="fab fa-reddit c-btn-icon c-mr-2"></span> Reddit</button>
<button type="button" class="c-btn c-btn-stack-overflow"><span class="fab fa-stack-overflow c-btn-icon c-mr-2"></span> Stack-Overflow</button>
<button type="button" class="c-btn c-btn-tumblr"><span class="fab fa-tumblr c-btn-icon c-mr-2"></span> Tumblr</button>
<button type="button" class="c-btn c-btn-twitter"><span class="fab fa-twitter c-btn-icon c-mr-2"></span> Twitter</button>
<button type="button" class="c-btn c-btn-vimeo"><span class="fab fa-vimeo c-btn-icon c-mr-2"></span> Vimeo</button>
<button type="button" class="c-btn c-btn-vk"><span class="fab fa-vk c-btn-icon c-mr-2"></span> Vk</button>
<button type="button" class="c-btn c-btn-xing"><span class="fab fa-xing c-btn-icon c-mr-2"></span> Xing</button>
<button type="button" class="c-btn c-btn-yahoo"><span class="fab fa-yahoo c-btn-icon c-mr-2"></span> Yahoo</button>
<button type="button" class="c-btn c-btn-youtube"><span class="fab fa-youtube c-btn-icon c-mr-2"></span> Youtube</button>

Btn bootstrap button classes

The .c-btn classes are designed for <button> , <a> or <input> elements (though some browsers may apply a slightly different rendering).

If you’re using .c-btn classes on <a> elements that are used to trigger functionality ex. collapsing content, these links should be given a role="button" to adequately communicate their meaning to assistive technologies such as screen readers.

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


CoreUI is delivered with bunch of Bootstrap’s button styles.

Pill buttons

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

Square buttons

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

Outline buttons

If you need a button, but without the strong background colors. Replace the default modifier classes with the .c-btn-outline-* ones to remove all background colors on any element with .c-btn class.

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

Ghost buttons

Use .c-btn-ghost-* class for ghost buttons.

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


Larger or smaller buttons? Add .c-btn-lg or .c-btn-sm for additional sizes.

<button type="button" class="c-btn c-btn-primary c-btn-lg">Large button</button>
<button type="button" class="c-btn c-btn-secondary c-btn-lg">Large button</button>
<button type="button" class="c-btn c-btn-primary c-btn-sm">Small button</button>
<button type="button" class="c-btn c-btn-secondary c-btn-sm">Small button</button>

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

<button type="button" class="c-btn c-btn-primary c-btn-lg c-btn-block">Block level button</button>
<button type="button" class="c-btn c-btn-secondary c-btn-lg c-btn-block">Block level button</button>

Active state

Buttons will appear pressed when active. There’s no requirement to attach a class to <button>s as they use a pseudo-class. Nevertheless, you can apply the same active appearance by adding the .active class and including the aria-pressed=“true” attribute.

<a href="#" class="c-btn c-btn-primary c-btn-lg active" role="button" aria-pressed="true">Primary link</a>
<a href="#" class="c-btn c-btn-secondary c-btn-lg active" role="button" aria-pressed="true">Link</a>

Disabled state

Add the disabled boolean attribute to any <button> element to make buttons look inactive.

<button type="button" class="c-btn c-btn-lg c-btn-primary" disabled>Primary button</button>
<button type="button" class="c-btn c-btn-secondary c-btn-lg" disabled>Button</button>

Disabled buttons using the <a> element behave a bit different:

<a>s don’t support the disabled attribute, so you have to add .disabled class to make buttons look inactive. The disabled bootstrap button must have the aria-disabled="true" attribute to show the state of the element to assistive technologies.

<a href="#" class="c-btn c-btn-primary c-btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Primary link</a>
<a href="#" class="c-btn c-btn-secondary c-btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Link</a>
Functionality hint

The .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, but that CSS property is not yet standardized. Besides, even in browsers that do support pointer-events: none, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, add a tabindex="-1" attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.

Button plugin

Make bootstrap buttons more powerful. Control button states or creates groups of buttons for extra elements like toolbars.

Toggle states

Add data-toggle="button" to toggle a button’s active state. If you’re pre-toggling a button, you must manually add the .active class and aria-pressed="true" to the <button>.

<button type="button" class="c-btn c-btn-primary" data-toggle="button" aria-pressed="false" autocomplete="off">
  Single toggle

Radio buttons

Bootstrap button styles can be connected to other elements, such as <label>s, to render radio style button toggling. Add data-toggle="buttons" to a .c-btn-group including those changed buttons to enable their toggling behavior via JavaScript and add .c-btn-group-toggle to style the <input>s within your buttons.

<div class="c-btn-group c-btn-group-toggle" data-toggle="buttons">
  <label class="c-btn c-btn-secondary active">
    <input type="radio" name="options" id="option1" autocomplete="off" checked> Active
  <label class="c-btn c-btn-secondary">
    <input type="radio" name="options" id="option2" autocomplete="off"> Radio
  <label class="c-btn c-btn-secondary">
    <input type="radio" name="options" id="option3" autocomplete="off"> Radio

Checkbox buttons

Bootstrap’s button styles can be connected to other elements, such as <label>s, to render checkbox or radio style button toggling. Add data-toggle="buttons" to a .btn-group including those changed buttons to enable their toggling behavior via JavaScript and add .btn-group-toggle to style the <input>s within your buttons.

<div class="c-btn-group-toggle" data-toggle="buttons">
  <label class="c-btn c-btn-secondary active">
    <input type="checkbox" checked autocomplete="off"> Checked

Methods Javascript

You can create a button instance with the button constructor, for example:

var button = document.getElementById('myButton')
var bsButton = new coreui.Button(button)
Method Description
toggle Toggles push state. Gives the button the appearance that it has been activated.
dispose Destroys an element’s button.

For example, to toggle all buttons

var buttons = document.querySelectorAll('.c-btn')
buttons.forEach(function (button) {
  var button = new coreui.Button(button)

Methods jQuery

Method Description
$().button('toggle') Toggles push state. Gives the button the appearance that it has been activated.
$().button('dispose') Destroys an element’s button.