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.
Examples
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="btn btn-primary">Primary Button</button>
<button type="button" class="btn btn-secondary">Secondary Button</button>
<button type="button" class="btn btn-success">Success Button</button>
<button type="button" class="btn btn-danger">Danger Button</button>
<button type="button" class="btn btn-warning">Warning Button</button>
<button type="button" class="btn btn-info">Info Button</button>
<button type="button" class="btn btn-light">Light Button</button>
<button type="button" class="btn btn-dark">Dark Button</button>
<button type="button" class="btn 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="btn btn-primary"><span class="cui-contrast"></span> Primary Button</button>
<button type="button" class="btn btn-secondary"><span class="cui-contrast"></span> Secondary Button</button>
<button type="button" class="btn btn-success"><span class="cui-contrast"></span> Success Button</button>
<button type="button" class="btn btn-danger"><span class="cui-contrast"></span> Danger Button</button>
<button type="button" class="btn btn-warning"><span class="cui-contrast"></span> Warning Button</button>
<button type="button" class="btn btn-info"><span class="cui-contrast"></span> Info Button</button>
<button type="button" class="btn btn-light"><span class="cui-contrast"></span> Light Button</button>
<button type="button" class="btn btn-dark"><span class="cui-contrast"></span> Dark Button</button>
<button type="button" class="btn btn-link">Link</button>
Btn bootstrap button classes
The .btn
classes are designed for <button>
, <a>
or <input>
elements (though some browsers may apply a slightly different rendering).
If you’re using .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="btn btn-primary" href="#" role="button">Link</a>
<button class="btn btn-primary" type="submit">Button</button>
<input class="btn btn-primary" type="button" value="Input">
<input class="btn btn-primary" type="submit" value="Submit">
<input class="btn btn-primary" type="reset" value="Reset">
Styles
CoreUI is delivered with bunch of Bootstrap’s button styles.
Pill buttons
<button type="button" class="btn btn-pill btn-primary">Primary Button</button>
<button type="button" class="btn btn-pill btn-secondary">Secondary Button</button>
<button type="button" class="btn btn-pill btn-success">Success Button</button>
<button type="button" class="btn btn-pill btn-danger">Danger Button</button>
<button type="button" class="btn btn-pill btn-warning">Warning Button</button>
<button type="button" class="btn btn-pill btn-info">Info Button</button>
<button type="button" class="btn btn-pill btn-light">Light Button</button>
<button type="button" class="btn btn-pill btn-dark">Dark Button</button>
Square buttons
<button type="button" class="btn btn-square btn-primary">Primary Button</button>
<button type="button" class="btn btn-square btn-secondary">Secondary Button</button>
<button type="button" class="btn btn-square btn-success">Success Button</button>
<button type="button" class="btn btn-square btn-danger">Danger Button</button>
<button type="button" class="btn btn-square btn-warning">Warning Button</button>
<button type="button" class="btn btn-square btn-info">Info Button</button>
<button type="button" class="btn btn-square btn-light">Light Button</button>
<button type="button" class="btn btn-square btn-dark">Dark Button</button>
Outline buttons
If you need a button, but without the strong background colors. Replace the default modifier classes with the .btn-outline-*
ones to remove all background colors on any element with .btn
class.
<button type="button" class="btn btn-outline-primary">Primary Button</button>
<button type="button" class="btn btn-outline-secondary">Secondary Button</button>
<button type="button" class="btn btn-outline-success">Success Button</button>
<button type="button" class="btn btn-outline-danger">Danger Button</button>
<button type="button" class="btn btn-outline-warning">Warning Button</button>
<button type="button" class="btn btn-outline-info">Info Button</button>
<button type="button" class="btn btn-outline-light">Light Button</button>
<button type="button" class="btn btn-outline-dark">Dark Button</button>
Ghost buttons
Use .btn-ghost-*
class for ghost buttons.
<button type="button" class="btn btn-ghost-primary">Primary Button</button>
<button type="button" class="btn btn-ghost-secondary">Secondary Button</button>
<button type="button" class="btn btn-ghost-success">Success Button</button>
<button type="button" class="btn btn-ghost-danger">Danger Button</button>
<button type="button" class="btn btn-ghost-warning">Warning Button</button>
<button type="button" class="btn btn-ghost-info">Info Button</button>
<button type="button" class="btn btn-ghost-light">Light Button</button>
<button type="button" class="btn btn-ghost-dark">Dark Button</button>
Brand buttons
<button type="button" class="btn btn-brand btn-behance">
<i class="fa fa-behance"></i><span>Behance</span>
</button>
<button type="button" class="btn btn-brand btn-css3">
<i class="fa fa-css3"></i><span>Css3</span>
</button>
<button type="button" class="btn btn-brand btn-dribbble">
<i class="fa fa-dribbble"></i><span>Dribbble</span>
</button>
<button type="button" class="btn btn-brand btn-dropbox">
<i class="fa fa-dropbox"></i><span>Dropbox</span>
</button>
<button type="button" class="btn btn-brand btn-facebook">
<i class="fa fa-facebook"></i><span>Facebook</span>
</button>
<button type="button" class="btn btn-brand btn-flickr">
<i class="fa fa-flickr"></i><span>Flickr</span>
</button>
<button type="button" class="btn btn-brand btn-github">
<i class="fa fa-github"></i><span>Github</span>
</button>
<button type="button" class="btn btn-brand btn-google-plus">
<i class="fa fa-google-plus"></i><span>Google plus</span>
</button>
<button type="button" class="btn btn-brand btn-html5">
<i class="fa fa-html5"></i><span>Html5</span>
</button>
<button type="button" class="btn btn-brand btn-instagram">
<i class="fa fa-instagram"></i><span>Instagram</span>
</button>
<button type="button" class="btn btn-brand btn-linkedin">
<i class="fa fa-linkedin"></i><span>Linkedin</span>
</button>
<button type="button" class="btn btn-brand btn-openid">
<i class="fa fa-openid"></i><span>Openid</span>
</button>
<button type="button" class="btn btn-brand btn-pinterest">
<i class="fa fa-pinterest"></i><span>Pinterest</span>
</button>
<button type="button" class="btn btn-brand btn-reddit">
<i class="fa fa-reddit"></i><span>Reddit</span>
</button>
<button type="button" class="btn btn-brand btn-spotify">
<i class="fa fa-spotify"></i><span>Spotify</span>
</button>
<button type="button" class="btn btn-brand btn-stack-overflow">
<i class="fa fa-stack-overflow"></i><span>Stack overflow</span>
</button>
<button type="button" class="btn btn-brand btn-tumblr">
<i class="fa fa-tumblr"></i><span>Tumblr</span>
</button>
<button type="button" class="btn btn-brand btn-twitter">
<i class="fa fa-twitter"></i><span>Twitter</span>
</button>
<button type="button" class="btn btn-brand btn-vimeo">
<i class="fa fa-vimeo"></i><span>Vimeo</span>
</button>
<button type="button" class="btn btn-brand btn-vk">
<i class="fa fa-vk"></i><span>Vk</span>
</button>
<button type="button" class="btn btn-brand btn-xing">
<i class="fa fa-xing"></i><span>Xing</span>
</button>
<button type="button" class="btn btn-brand btn-yahoo">
<i class="fa fa-yahoo"></i><span>Yahoo</span>
</button>
<button type="button" class="btn btn-brand btn-youtube">
<i class="fa fa-youtube"></i><span>Youtube</span>
</button>
Only icons
<button type="button" class="btn btn-brand btn-behance">
<i class="fa fa-behance"></i>
</button>
<button type="button" class="btn btn-brand btn-css3">
<i class="fa fa-css3"></i>
</button>
<button type="button" class="btn btn-brand btn-dribbble">
<i class="fa fa-dribbble"></i>
</button>
<button type="button" class="btn btn-brand btn-dropbox">
<i class="fa fa-dropbox"></i>
</button>
<button type="button" class="btn btn-brand btn-facebook">
<i class="fa fa-facebook"></i>
</button>
<button type="button" class="btn btn-brand btn-flickr">
<i class="fa fa-flickr"></i>
</button>
<button type="button" class="btn btn-brand btn-github">
<i class="fa fa-github"></i>
</button>
<button type="button" class="btn btn-brand btn-google-plus">
<i class="fa fa-google-plus"></i>
</button>
<button type="button" class="btn btn-brand btn-html5">
<i class="fa fa-html5"></i>
</button>
<button type="button" class="btn btn-brand btn-instagram">
<i class="fa fa-instagram"></i>
</button>
<button type="button" class="btn btn-brand btn-linkedin">
<i class="fa fa-linkedin"></i>
</button>
<button type="button" class="btn btn-brand btn-openid">
<i class="fa fa-openid"></i>
</button>
<button type="button" class="btn btn-brand btn-pinterest">
<i class="fa fa-pinterest"></i>
</button>
<button type="button" class="btn btn-brand btn-reddit">
<i class="fa fa-reddit"></i>
</button>
<button type="button" class="btn btn-brand btn-spotify">
<i class="fa fa-spotify"></i>
</button>
<button type="button" class="btn btn-brand btn-stack-overflow">
<i class="fa fa-stack-overflow"></i>
</button>
<button type="button" class="btn btn-brand btn-tumblr">
<i class="fa fa-tumblr"></i>
</button>
<button type="button" class="btn btn-brand btn-twitter">
<i class="fa fa-twitter"></i>
</button>
<button type="button" class="btn btn-brand btn-vimeo">
<i class="fa fa-vimeo"></i>
</button>
<button type="button" class="btn btn-brand btn-vk">
<i class="fa fa-vk"></i>
</button>
<button type="button" class="btn btn-brand btn-xing">
<i class="fa fa-xing"></i>
</button>
<button type="button" class="btn btn-brand btn-yahoo">
<i class="fa fa-yahoo"></i>
</button>
<button type="button" class="btn btn-brand btn-youtube">
<i class="fa fa-youtube"></i>
</button>
Only text
<button type="button" class="btn btn-brand btn-behance">
Behance
</button>
<button type="button" class="btn btn-brand btn-css3">
Css3
</button>
<button type="button" class="btn btn-brand btn-dribbble">
Dribbble
</button>
<button type="button" class="btn btn-brand btn-dropbox">
Dropbox
</button>
<button type="button" class="btn btn-brand btn-facebook">
Facebook
</button>
<button type="button" class="btn btn-brand btn-flickr">
Flickr
</button>
<button type="button" class="btn btn-brand btn-github">
Github
</button>
<button type="button" class="btn btn-brand btn-google-plus">
Google plus
</button>
<button type="button" class="btn btn-brand btn-html5">
Html5
</button>
<button type="button" class="btn btn-brand btn-instagram">
Instagram
</button>
<button type="button" class="btn btn-brand btn-linkedin">
Linkedin
</button>
<button type="button" class="btn btn-brand btn-openid">
Openid
</button>
<button type="button" class="btn btn-brand btn-pinterest">
Pinterest
</button>
<button type="button" class="btn btn-brand btn-reddit">
Reddit
</button>
<button type="button" class="btn btn-brand btn-spotify">
Spotify
</button>
<button type="button" class="btn btn-brand btn-stack-overflow">
Stack overflow
</button>
<button type="button" class="btn btn-brand btn-tumblr">
Tumblr
</button>
<button type="button" class="btn btn-brand btn-twitter">
Twitter
</button>
<button type="button" class="btn btn-brand btn-vimeo">
Vimeo
</button>
<button type="button" class="btn btn-brand btn-vk">
Vk
</button>
<button type="button" class="btn btn-brand btn-xing">
Xing
</button>
<button type="button" class="btn btn-brand btn-yahoo">
Yahoo
</button>
<button type="button" class="btn btn-brand btn-youtube">
Youtube
</button>
Size
Larger or smaller buttons? Add .btn-lg
or .btn-sm
for additional sizes.
<button type="button" class="btn btn-primary btn-lg">Large button</button>
<button type="button" class="btn btn-secondary btn-lg">Large button</button>
<button type="button" class="btn btn-primary btn-sm">Small button</button>
<button type="button" class="btn btn-secondary btn-sm">Small button</button>
Create buttons that span the full width of a parent—by adding .btn-block
.
<button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
<button type="button" class="btn btn-secondary btn-lg 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="btn btn-primary btn-lg active" role="button" aria-pressed="true">Primary link</a>
<a href="#" class="btn btn-secondary 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="btn btn-lg btn-primary" disabled>Primary button</button>
<button type="button" class="btn btn-secondary btn-lg" disabled>Button</button>
<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="btn btn-primary btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Primary link</a>
<a href="#" class="btn btn-secondary 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 button 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="btn btn-primary" data-toggle="button" aria-pressed="false" autocomplete="off">
Single toggle
</button>
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 .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="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="options" id="option1" autocomplete="off" checked> Active
</label>
<label class="btn btn-secondary">
<input type="radio" name="options" id="option2" autocomplete="off"> Radio
</label>
<label class="btn btn-secondary">
<input type="radio" name="options" id="option3" autocomplete="off"> Radio
</label>
</div>
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="btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="checkbox" checked autocomplete="off"> Checked
</label>
</div>
Methods
Method | Description |
---|---|
$().button('toggle') |
Toggles push state. Gives the button the appearance that it has been activated. |
$().button('dispose') |
Destroys an element’s button. |