Button Examples
- -About This Example
-The following command and toggle button examples demonstrate the Button Pattern.
-Similar examples include:
--
-
- Navigation Menu Button: A button that opens a menu of items that behave as links. -
-
- Action Menu Button Example Using
element.focus(): - A button that opens a menu of actions or commands where focus in the menu is managed usingelement.focus(). -
- -
- Action Menu Button Example Using
aria-activedescendant: - A button that opens a menu of actions or commands where focus in the menu is managed usingaria-activedescendant. -
-
-
-
-
-
Example
-This Print
action button uses a div element.
Print Page
@@ -81,145 +37,5 @@
Keyboard Support
- -| Key | -Function | -
|---|---|
| Enter | -Activates the button. | -
| Space | -Activates the button. | -
Role, Property, State, and Tabindex Attributes
- -| Role | -Attribute | -Element | -Usage | -
|---|---|---|---|
button |
- - | div, a |
-
-
|
-
| - |
- tabindex="0"
- |
- div, a |
-
-
|
-
| - | aria-pressed="false" |
- a |
-
-
|
-
| - | aria-pressed="true" |
- a |
-
-
|
-
Assistive Technology Support
-Learn how to interpret and use assistive technology support data
-Command Button
- - -Toggle Button
- -JavaScript and CSS Source Code
- --
-
- - CSS: - button.css - -
- - JavaScript: - button.js - -
HTML Source Code
-To copy the following HTML code, please open it in CodePen.
- -
-
-
-