Use Muze's custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
Bootstrap Buttons documentationUsing 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.
If you don’t want the button text to wrap, you can add the .text-nowrap
class to the button. In Sass, you can set $btn-white-space: nowrap
to disable text wrapping for each button.
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-primary" href="#0" 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">
Use .btn-*
, .btn-outline-*
, .btn-soft-*
classes to change the visual style of the button.
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-outline-primary">Outline</button>
<button type="button" class="btn btn-soft-primary">Ghost</button>
<button type="button" class="btn btn-lg btn-primary mb-2 me-2">
<span class="pe-1">Icon Right</span>
<svg class="ms-2" xmlns="http://www.w3.org/2000/svg" width="7" height="11" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-lg btn-primary mb-2 me-2">
<svg class="me-2" xmlns="http://www.w3.org/2000/svg" width="7" height="11" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
Icon Left
</button>
<button type="button" class="btn btn-lg btn-primary rounded-0">Sharp</button>
<button type="button" class="btn btn-lg btn-primary">Soft</button>
<button type="button" class="btn btn-lg btn-primary rounded-6">Rounded 6</button>
<button type="button" class="btn btn-lg btn-primary rounded-12">Rounded 12</button>
<button type="button" class="btn btn-lg btn-primary rounded-24">Rounded 24</button>
<button type="button" class="btn btn-lg btn-primary rounded-pill">Rounded Pill</button>
Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.
<button type="button" class="btn btn-lg btn-primary">Primary</button>
<button type="button" class="btn btn-lg btn-secondary">Secondary</button>
<button type="button" class="btn btn-lg btn-success">Success</button>
<button type="button" class="btn btn-lg btn-danger">Danger</button>
<button type="button" class="btn btn-lg btn-warning">Warning</button>
<button type="button" class="btn btn-lg btn-info">Info</button>
<button type="button" class="btn btn-lg btn-light">Light</button>
<button type="button" class="btn btn-lg btn-dark">Dark</button>
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-lg btn-outline-primary">Primary</button>
<button type="button" class="btn btn-lg btn-outline-secondary">Secondary</button>
<button type="button" class="btn btn-lg btn-outline-success">Success</button>
<button type="button" class="btn btn-lg btn-outline-danger">Danger</button>
<button type="button" class="btn btn-lg btn-outline-warning">Warning</button>
<button type="button" class="btn btn-lg btn-outline-info">Info</button>
<button type="button" class="btn btn-lg btn-outline-light">Light</button>
<button type="button" class="btn btn-lg btn-outline-dark">Dark</button>
Use .btn-soft-*
<button type="button" class="btn btn-lg btn-soft-primary">Primary</button>
<button type="button" class="btn btn-lg btn-soft-secondary">Secondary</button>
<button type="button" class="btn btn-lg btn-soft-success">Success</button>
<button type="button" class="btn btn-lg btn-soft-danger">Danger</button>
<button type="button" class="btn btn-lg btn-soft-warning">Warning</button>
<button type="button" class="btn btn-lg btn-soft-info">Info</button>
<button type="button" class="btn btn-lg btn-soft-light">Light</button>
<button type="button" class="btn btn-lg btn-soft-dark">Dark</button>
<button type="button" class="btn btn-xl btn-primary mb-2 me-2">
<span class="pe-1">Icon Right</span>
<svg class="ms-2" xmlns="http://www.w3.org/2000/svg" width="8" height="14" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-lg btn-primary mb-2 me-2">
<span class="pe-1">Icon Right</span>
<svg class="ms-2" xmlns="http://www.w3.org/2000/svg" width="7" height="11" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-primary mb-2 me-2">
Icon Right
<svg class="ms-2" xmlns="http://www.w3.org/2000/svg" width="7" height="10" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-sm btn-primary mb-2">
Icon Right
<svg class="ms-2" xmlns="http://www.w3.org/2000/svg" width="5" height="8" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
</button>
<-- Icon Left -->
<button type="button" class="btn btn-xl btn-primary mb-2 me-2">
<svg class="me-2" xmlns="http://www.w3.org/2000/svg" width="8" height="14" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
<span class="ps-1">Icon Left</span>
</button>
<button type="button" class="btn btn-lg btn-primary mb-2 me-2">
<svg class="me-2" xmlns="http://www.w3.org/2000/svg" width="7" height="11" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
Icon Left
</button>
<button type="button" class="btn btn-primary mb-2 me-2">
<svg class="me-2" xmlns="http://www.w3.org/2000/svg" width="7" height="10" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
Icon Left
</button>
<button type="button" class="btn btn-sm btn-primary mb-2">
<svg class="me-1" xmlns="http://www.w3.org/2000/svg" width="5" height="8" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#fff"/>
</svg>
Icon Left
</button>
Fancy larger smaller or extra smaller buttons? Add .btn-xl
, .btn-lg
or .btn-sm
for additional sizes.
<button type="button" class="btn btn-primary btn-xl">Primary</button>
<button type="button" class="btn btn-primary btn-lg">Primary</button>
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-primary btn-sm">Primary</button>
Fancy Icon buttons? Add .btn-icon
for additional sizes.
<button type="button" class="btn btn-primary btn-icon btn-xl mb-2 me-2">
<svg data-name="Icons/Tabler/Notification" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<rect data-name="Icons/Tabler/Notification background" width="24" height="24" fill="none"/>
<path d="M6.162,19.63l-.005-.246v-.308H.926A.923.923,0,0,1,.471,17.35a4,4,0,0,0,1.956-2.66l.036-.229V10.726A9.492,9.492,0,0,1,7.292,2.873l.147-.08,0-.018A3.369,3.369,0,0,1,10.566.007L10.771,0a3.379,3.379,0,0,1,3.287,2.573l.045.22.147.08a9.556,9.556,0,0,1,4.806,7.541l.023.355-.007,3.582a4.016,4.016,0,0,0,2,3,.924.924,0,0,1-.329,1.719l-.126.008H15.387v.308a4.616,4.616,0,0,1-9.225.246ZM8,19.385a2.769,2.769,0,0,0,5.532.189l.007-.189v-.308H8ZM9.242,3.228l-.012.238-.005.045L9.2,3.63l-.039.113-.054.107-.035.055L9,4l-.036.038-.05.046-.1.074L8.7,4.219A7.7,7.7,0,0,0,4.332,10.46l-.022.309-.007,3.8a5.875,5.875,0,0,1-.94,2.541l-.084.119H18.266l-.007-.012a6.007,6.007,0,0,1-.983-2.452l-.043-.306V10.812a7.674,7.674,0,0,0-4.4-6.593.919.919,0,0,1-.518-.7l-.009-.132a1.538,1.538,0,0,0-3.069-.157Z" transform="translate(1.499)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-primary btn-icon btn-lg mb-2 me-2">
<svg data-name="Icons/Tabler/Notification" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
<rect data-name="Icons/Tabler/Notification background" width="24" height="24" fill="none"/>
<path d="M6.162,19.63l-.005-.246v-.308H.926A.923.923,0,0,1,.471,17.35a4,4,0,0,0,1.956-2.66l.036-.229V10.726A9.492,9.492,0,0,1,7.292,2.873l.147-.08,0-.018A3.369,3.369,0,0,1,10.566.007L10.771,0a3.379,3.379,0,0,1,3.287,2.573l.045.22.147.08a9.556,9.556,0,0,1,4.806,7.541l.023.355-.007,3.582a4.016,4.016,0,0,0,2,3,.924.924,0,0,1-.329,1.719l-.126.008H15.387v.308a4.616,4.616,0,0,1-9.225.246ZM8,19.385a2.769,2.769,0,0,0,5.532.189l.007-.189v-.308H8ZM9.242,3.228l-.012.238-.005.045L9.2,3.63l-.039.113-.054.107-.035.055L9,4l-.036.038-.05.046-.1.074L8.7,4.219A7.7,7.7,0,0,0,4.332,10.46l-.022.309-.007,3.8a5.875,5.875,0,0,1-.94,2.541l-.084.119H18.266l-.007-.012a6.007,6.007,0,0,1-.983-2.452l-.043-.306V10.812a7.674,7.674,0,0,0-4.4-6.593.919.919,0,0,1-.518-.7l-.009-.132a1.538,1.538,0,0,0-3.069-.157Z" transform="translate(1.499)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-primary btn-icon mb-2 me-2">
<svg data-name="Icons/Tabler/Notification" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24">
<rect data-name="Icons/Tabler/Notification background" width="24" height="24" fill="none"/>
<path d="M6.162,19.63l-.005-.246v-.308H.926A.923.923,0,0,1,.471,17.35a4,4,0,0,0,1.956-2.66l.036-.229V10.726A9.492,9.492,0,0,1,7.292,2.873l.147-.08,0-.018A3.369,3.369,0,0,1,10.566.007L10.771,0a3.379,3.379,0,0,1,3.287,2.573l.045.22.147.08a9.556,9.556,0,0,1,4.806,7.541l.023.355-.007,3.582a4.016,4.016,0,0,0,2,3,.924.924,0,0,1-.329,1.719l-.126.008H15.387v.308a4.616,4.616,0,0,1-9.225.246ZM8,19.385a2.769,2.769,0,0,0,5.532.189l.007-.189v-.308H8ZM9.242,3.228l-.012.238-.005.045L9.2,3.63l-.039.113-.054.107-.035.055L9,4l-.036.038-.05.046-.1.074L8.7,4.219A7.7,7.7,0,0,0,4.332,10.46l-.022.309-.007,3.8a5.875,5.875,0,0,1-.94,2.541l-.084.119H18.266l-.007-.012a6.007,6.007,0,0,1-.983-2.452l-.043-.306V10.812a7.674,7.674,0,0,0-4.4-6.593.919.919,0,0,1-.518-.7l-.009-.132a1.538,1.538,0,0,0-3.069-.157Z" transform="translate(1.499)" fill="#fff"/>
</svg>
</button>
<button type="button" class="btn btn-primary btn-icon btn-sm mb-2 me-2">
<svg data-name="Icons/Tabler/Notification" xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24">
<rect data-name="Icons/Tabler/Notification background" width="24" height="24" fill="none"/>
<path d="M6.162,19.63l-.005-.246v-.308H.926A.923.923,0,0,1,.471,17.35a4,4,0,0,0,1.956-2.66l.036-.229V10.726A9.492,9.492,0,0,1,7.292,2.873l.147-.08,0-.018A3.369,3.369,0,0,1,10.566.007L10.771,0a3.379,3.379,0,0,1,3.287,2.573l.045.22.147.08a9.556,9.556,0,0,1,4.806,7.541l.023.355-.007,3.582a4.016,4.016,0,0,0,2,3,.924.924,0,0,1-.329,1.719l-.126.008H15.387v.308a4.616,4.616,0,0,1-9.225.246ZM8,19.385a2.769,2.769,0,0,0,5.532.189l.007-.189v-.308H8ZM9.242,3.228l-.012.238-.005.045L9.2,3.63l-.039.113-.054.107-.035.055L9,4l-.036.038-.05.046-.1.074L8.7,4.219A7.7,7.7,0,0,0,4.332,10.46l-.022.309-.007,3.8a5.875,5.875,0,0,1-.94,2.541l-.084.119H18.266l-.007-.012a6.007,6.007,0,0,1-.983-2.452l-.043-.306V10.812a7.674,7.674,0,0,0-4.4-6.593.919.919,0,0,1-.518-.7l-.009-.132a1.538,1.538,0,0,0-3.069-.157Z" transform="translate(1.499)" fill="#fff"/>
</svg>
</button>
Fancy buttons links? Add .btn-link
for additional sizes.
<button type="button" class="btn btn-xl btn-link mb-2 me-3">
Link
<svg class="ms-1" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#0D6EFD"/>
</svg>
</button>
<button type="button" class="btn btn-lg btn-link mb-2 me-3">
Link
<svg class="ms-1" xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#0D6EFD"/>
</svg>
</button>
<button type="button" class="btn btn-link mb-2 me-3">
Link
<svg class="ms-1" xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#0D6EFD"/>
</svg>
</button>
<button type="button" class="btn btn-sm btn-link mb-2">
Link
<svg class="ms-1" xmlns="http://www.w3.org/2000/svg" width="7" height="7" viewBox="0 0 10 18">
<path d="M.293.293a1,1,0,0,1,1.3-.1l.112.1,8,8a1,1,0,0,1,.1,1.3l-.1.112-8,8A1,1,0,0,1,.2,16.405l.1-.112L7.585,9,.293,1.707A1,1,0,0,1,.2.405Z" transform="translate(0 0)" fill="#0D6EFD"/>
</svg>
</button>
Create block level buttons—those that span the full width of a parent—by adding .btn-block
.
Make buttons look inactive by adding the disabled
boolean attribute to any <button>
element. Disabled buttons have pointer-events: none
applied to, preventing hover and active states from triggering.
Disabled buttons using the <a>
element behave a bit different:
<a>
s don’t support the disabled
attribute, so you must add the .disabled
class to make it visually appear disabled.pointer-events
on anchor buttons. In browsers which support that property, you won’t see the disabled cursor at all.aria-disabled="true"
attribute to indicate the state of the element to assistive technologies.
<button class="btn btn-xl btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-lg btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-sm btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-xl btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-lg btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-sm btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-xl btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-lg btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-sm btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
<span class="sr-only">Loading...</span>
</button>
<button class="btn btn-xl btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-lg btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-sm btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm me-2" role="status" aria-hidden="true"></span>
Loading...
</button>
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. In addition, 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.
The button plugin allows you to create simple on/off toggle buttons.
Add data-bs-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-bs-toggle="button">Toggle button</button>
<button type="button" class="btn btn-primary active" data-bs-toggle="button" aria-pressed="true">Active toggle button</button>
<button type="button" class="btn btn-primary" disabled data-bs-toggle="button">Disabled toggle button</button>
<a href="#0" class="btn btn-primary" role="button" data-bs-toggle="button">Toggle link</a>
<a href="#0" class="btn btn-primary active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
<a href="#0" class="btn btn-primary disabled" role="button" data-bs-toggle="button">Disabled toggle link</a>
You can create a button instance with the button constructor, for example:
var button = document.getElementById('myButton')
var bsButton = new bootstrap.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('.btn')
buttons.forEach(function (button) {
var button = new bootstrap.Button(button)
button.toggle()
})