

Photo: Karl Anderson
Button
Introduction
Create distinct, actionable buttons with options for icons, color, sizing, and customization.
Using Buttons
To use buttons in Natura11y, add .button to an <a> or <button> element. Buttons inherit the text color and font size of their parent element by default.
1<!-- Link styled as a button -->2<a class="button" href="#1">3 Button4</a>5
6<!-- Button element -->7<button class="button" type="button">8 Button9</button>10
11<!-- Text span for underline on hover/focus -->12<a class="button" href="#1">13 <span class="text">Button</span>14</a>Coloring Buttons
Add color to a .button selector with theme color utilities. These classes apply the button’s appropriate text color automatically.
<a class="button theme-primary" href="#1"> Primary</a>
<a class="button theme-secondary" href="#1"> Secondary</a>
<a class="button theme-dark" href="#1"> Dark</a>Full-width Buttons
For buttons that span the width of their parent, add the .width-100 utility. Do not use .display-block; buttons use flex for vertical centering, especially when icons are present.
<a class="button theme-primary width-100" href="#1"> Button</a>Outlined Buttons
Create a button with an outline instead of a fill. Add .button--outline to the .button selector. The outline color inherits from the button’s current text color.
Button Border Radius
Globally, all .button selectors have a border radius set with --button-border-radius. You can also use border-radius utility classes directly on .button selectors.
<a class="button theme-primary border-radius-0" href="#1"> Button</a>
<a class="button theme-secondary border-radius-pill" href="#1"> Button</a>Sizing Buttons
Buttons inherit font size. Padding uses relative units, so resizing a parent with a font-size utility resizes the buttons inside it.
<ul class="nav nav--horizontal font-size-sm"> <li> <a class="button" href="#1">Button</a> </li> <li> <a class="button" href="#1">Button</a> </li> <li> <a class="button" href="#1">Button</a> </li></ul>Text and Icon Buttons
To include an icon in a button, add an icon element as a child of .button. Icons can appear before or after the text.
1<a class="button theme-primary" href="#1">2 <span class="icon icon-edit" aria-hidden="true"></span>3 <span class="text">Edit</span>4</a>5
6<a class="button button--outline" href="#1">7 <span class="text">Delete</span>8 <span class="icon icon-delete" aria-hidden="true"></span>9</a>Disperse Buttons
Create a button where the text and icon sit on opposing sides. Add .button--disperse to the .button selector. This modifier makes the button full-width of its parent by default.
<a class="button button--disperse text-color-link" href="#1"> <span class="text">Button</span> <span class="icon icon-arrow-right" aria-hidden="true"></span></a>Icon-only Buttons
For icon-only buttons, apply .button--icon-only to the .button selector. Icon-only buttons require an accessible name with aria-label and the icon should be hidden from assistive technology with aria-hidden="true".
<a class="button button--icon-only" href="#1" aria-label="Home"> <span class="icon icon-home" aria-hidden="true"></span></a>
<a class="button button--icon-only theme-primary" href="#1" aria-label="Print"> <span class="icon icon-print" aria-hidden="true"></span></a>Icon Over Text Buttons
Position a prominent icon over smaller text with .button--icon-over-text. The icon and text use .button__icon and .button__text child elements.
1<button class="button button--icon-over-text" type="button">2
3 <span class="button__icon">4 <span class="icon icon-home" aria-hidden="true"></span>5 </span>6
7 <span class="button__text">Home</span>8
9</button>Related Custom Properties
Button styles can be customized by redefining the related CSS custom properties.
:root { --button-padding-x: 1.25em; --button-padding-y: 0.5em; --button-target-size: 2.5em; --button-font-family: var(--body-font-family); --button-font-weight: var(--font-weight-bold); --button-text-transform: initial; --button-letter-spacing: normal; --button-border-radius: 0.25em; --button-outline-border-width: calc(var(--border-width) * 2); --button-icon-over-text-width: 4em; --button-icon-over-text-border-radius: var(--button-border-radius); --button-icon-over-text-font-size: 0.675em;}| Custom property | Default | Purpose |
|---|---|---|
--button-padding-x | 1.25em | Left and right padding for regular buttons. |
--button-padding-y | 0.5em | Top and bottom padding for regular buttons. |
--button-target-size | 2.5em | Minimum target size for buttons and related controls. |
--button-font-family | var(--body-font-family) | Font family for regular button text. |
--button-font-weight | var(--font-weight-bold) | Font weight for regular button text. |
--button-text-transform | initial | Text transform for regular button text. |
--button-letter-spacing | normal | Letter spacing for regular button text. |
--button-border-radius | 0.25em | Default button border radius. |
--button-outline-border-width | calc(var(--border-width) * 2) | Outline width for `.button--outline`. |
--button-icon-over-text-width | 4em | Width of `.button--icon-over-text` buttons. |
--button-icon-over-text-border-radius | var(--button-border-radius) | Border radius of the icon container in `.button--icon-over-text`. |
--button-icon-over-text-font-size | 0.675em | Font size of `.button__text` in `.button--icon-over-text`. |
Search Docs
Search documentation pages and page sections.
46 pages available.


Accordion

Alert

Aspect Ratio

Backdrop

Badge

Border

Breadcrumb

Breakpoint

Button

Card

Collapse

Color

Container

Customization

Display

Dropdown

Figma

Flex

Flyout

Form

Get Started

Gradient

Grid

Icon

Layer

Lightbox

Link

Main Menu

Modal

Navigation

Nested Nav

Opacity

Overflow

Pagination

Position

React

RTL

Shadow

Sizing

Spacing

Tab

Table

Track

Typography

Z-index
No results found for ''

