Buttons are mildly skeuomorphic, interactive elements that utilize shape and color to guide users to take actions or make choices. They should have a clear and appropriate verb that describes the choice the user is being presented with. Icons may be used in conjunction with text, but they must be contextually appropriate and send the same message if the text were hidden.
Button Styles
There are 6 button styles:
Default, the general button style.
Primary, indicates the critical, or most important action on a form/page.
Danger, indicates a dangerous, generally destructive action, such as deleting.
Success, indicates a positive action.
Warning, indicates an action that may have some side effects, such as giving a user admin access.
Link, used for non-critical actions. Useful for keeping the interface simple.
All buttons are prefixed with the btn class. The btn class can be applied to any element. Try to use <button> elements when an action won’t change the URL/route, and <a> elements when the action will change the URL/route.
Disabled state
Button Sizes
There are 4 different button sizes:
Large - use the btn-lg class
Normal - no extra classes necessary
Small - use the btn-sm class
Extra small - use the btn-xs class
Block Level Buttons
Use the btn-block class for buttons that fill the width of their container. These are useful for narrow containers and cleaning up alignment.
Toggle Buttons
Similar to a checkbox, toggle buttons can be toggled between active or not active.
Add the active class and the aria-pressed="true" attribute to a button to visually hold a depressed state.
Dropdown Buttons
Dropdown buttons can provide a menu or popover when clicked.
Split buttons contain both a button and a dropdown. Clicking the button performs the action. Clicking the dropdown reveals other actions. Generally, the button is the primary or most common action, and items in the dropdown are secondary or less common actions.
Icon buttons are buttons with an icon inside. An icon button may or may not have text. Icon buttons can help save space or improve the ability to scan/find buttons quickly.
Use btn-icon-only for buttons with only an icon in it. This optimizes the padding.