Button with solid and borderless variants, any tone (.mdst-danger and friends), toggle and disabled states, and three sizes. Variants are just variables, so you can make your own.
Variants
| Class | Example |
|---|---|
| .mdst-button | |
| .mdst-button--solid | |
| .mdst-button--borderless | |
| .mdst-button .mdst-danger | |
| Side by side |
Sizes
| Class | Example |
|---|---|
| .mdst-button--sm | |
| .mdst-button | |
| .mdst-button--lg |
States
| Class / Attribute | Example |
|---|---|
| disabled | |
| .mdst-button--solid disabled | |
| aria-pressed | |
| <a> aria-disabled | Read the docs Disabled link |
Custom variants
Variants only set variables: make your own on a class, a container, or an inline style.
| Variable | Example |
|---|---|
| --mdst-button-tone | |
| --mdst-button-bg --mdst-button-border |
Hover
Hover draws a ring in the button's text colour, so it suits every variant and theme. Change it with
--mdst-button-hover-shadow: any box-shadow, or none to switch it off.
| Value | Example (hover) |
|---|---|
| default | |
| none | |
| 3px 3px 0 currentColor |
Usage
<button class="mdst-button">Default</button>
<button class="mdst-button mdst-button--solid">Inverted</button>
<button class="mdst-button mdst-button--borderless">Ghost</button>
<button class="mdst-button mdst-button--sm">Small</button>
<button class="mdst-button mdst-button--lg">Large</button>
<!-- Danger is a colour: combine it with any variant -->
<button class="mdst-button mdst-danger mdst-button--solid">Delete</button>
<!-- Toggle buttons -->
<button class="mdst-button" aria-pressed="true">Bold</button>
<!-- Links can't be disabled: drop the href, keep role="link", add aria-disabled -->
<a class="mdst-button" role="link" aria-disabled="true">Unavailable</a>
/* Hover: any box-shadow, or none */
:root { --mdst-button-hover-shadow: none; }
/* Prefer an underline? Add your own rule */
.mdst-ui button:hover { text-decoration: underline; }
<!-- Your own variant: set the variables -->
.btn-brand { --mdst-button-tone: #4338ca; }
<button class="mdst-button mdst-button--solid btn-brand">Brand</button>