/*
Button

@uswds https://standards.usa.gov/components/buttons

Use buttons to signal actions.

Markup: button.example.html

Style guide: components.button
*/

/*
Button icons

- Add an inline SVG icon and it will become the same color as the button text. For the crispest icon rendering, ensure the icon has a square `viewBox` with values that are multiples of `8` (ie. `24x24`).
- Use the margin utility class to add spacing between the icon and button text.

Markup: button-icons.example.html

Style guide: components.button.icons
*/

/*
Button inline with field

The button is the same height as a single-line text field.

Markup: button-inline.example.html

Style guide: components.button.inline-field
*/

/*
`<Button>`

@react-component Button

Style guide: components.button.react
*/

/*
---

### When to use

- Use buttons for the most important actions you want users to take on your site, such as "Download," "Sign up," or "Apply."

### When to consider alternatives

- Less popular or less important actions may be visually styled as links.
- Buttons are for performing actions, not making choices. If you need your users to make a choice, use something else like radio buttons. Alternatively, if one choice is much less important then try styling it as a link instead.

### Usage

- Use the "primary" button variation for the button most users should click. This is your primary call-to-action.
- Avoid using too many buttons on a page. Aim to use only one button per page.
- Avoid similar styles elsewhere on the page that could be confused for buttons.
- Use buttons for the primary action and links for secondary actions.

**Label text**

- Use sentence case for button labels.
- Button labels should be as short as possible with “trigger words” that your users will recognize to clearly explain what will happen when the button is clicked (for example, “Save and continue,” “Download” or “Sign up”).
- Make the first word of the button’s label a verb. For example, instead of “Complaint Filing”, label the button “File a complaint.”
- If a button has an icon, it should still have accompanying text describing the action.

**Destructive buttons**

- Use the "danger" button variation for destructive buttons. For example, buttons that delete or reset a user's information.
- Confirm the user meant to trigger a destructive action before following through with the action.
- Provide a method for a user to undo a destructive action.

**Disabled buttons**

- Don’t disable buttons, unless there’s a good reason to.
- If you do disable a button, make sure it receives the disabled styling. A `button` element will automatically be styled as a disabled button when it has the `disabled` HTML attribute, but an `a` element will need to have the `.ds-c-button--disabled` class applied to it.

### Accessibility

- Buttons should display a visible focus state when users tab to them.
- Create a button with a `button` or `a` element to retain the native click functionality. Avoid using `<div>` or `<img>` tags to create buttons. Screen readers don't automatically know either is a usable button.
- When styling links to look like buttons, remember that screen readers handle links slightly differently than they do buttons. Pressing the `Space` key triggers a button, but pressing the `Enter` key triggers a link.
- Dimmed or unavailable buttons should have the `disabled` attribute applied. This removes native click and keypress events from the button. It also prevents automated scanners from logging a low contrast error. Finally, it announces the button as "dimmed" or "disabled" to screen readers, offering users additional context.

### Learn more

- [Beyond Blue Links: Making Clickable Elements Recognizable](https://www.nngroup.com/articles/clickable-elements/)
- [7 Basic Best Practices for Buttons](http://www.uxmatters.com/mt/archives/2012/05/7-basic-best-practices-for-buttons.php)
- [The Grammar of Interactivity](http://www.uxbooth.com/articles/the-grammar-of-interactivity/)
- [GOV.UK navigation buttons discussion](https://paper.dropbox.com/doc/Navigation-buttons-continue-next-previous-ghLqL5a9Ostxxb3rvBhyO)

**Button alignment**
- [Buttons on forms and surveys: a look at some research](http://www.slideshare.net/cjforms/buttons-on-forms-and-surveys-a-look-at-some-research-2012)
- [Previous and Next Actions in Web Forms](https://www.lukew.com/ff/entry.asp?730=)

**ARIA**
- [Using the button role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_button_role)
- [Building Accessible Buttons with ARIA](https://www.deque.com/blog/accessible-aria-buttons)

Style guide: components.button.guidance
*/
