@@ -10,6 +10,41 @@ import { TabindexMixin } from '@vaadin/field-base/src/tabindex-mixin.js';
1010import { ActiveMixin } from '@vaadin/field-base/src/active-mixin.js' ;
1111import { FocusMixin } from '@vaadin/field-base/src/focus-mixin.js' ;
1212
13+ /**
14+ * `<vaadin-button>` is an accessible and customizable button that allows users to perform actions.
15+ *
16+ * ```html
17+ * <vaadin-button>Press me</vaadin-button>
18+ * ```
19+ *
20+ * ### Styling
21+ *
22+ * The following shadow DOM parts are available for styling:
23+ *
24+ * Part name | Description
25+ * ----------|-------------
26+ * `label` | The label (text) inside the button.
27+ * `prefix` | A slot for content before the label (e.g. an icon).
28+ * `suffix` | A slot for content after the label (e.g. an icon).
29+ *
30+ * The following attributes are available for styling:
31+ *
32+ * Attribute | Description
33+ * -------------|-------------
34+ * `active` | Set when the button is pressed down, either with mouse, touch or the keyboard.
35+ * `disabled` | Set when the button is disabled.
36+ * `focus-ring` | Set when the button is focused using the keyboard.
37+ * `focused` | Set when the button is focused.
38+ *
39+ * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
40+ *
41+ * @extends HTMLElement
42+ * @mixes ActiveMixin
43+ * @mixes TabindexMixin
44+ * @mixes FocusMixin
45+ * @mixes ElementMixin
46+ * @mixes ThemableMixin
47+ */
1348class Button extends ActiveMixin ( TabindexMixin ( FocusMixin ( ElementMixin ( ThemableMixin ( PolymerElement ) ) ) ) ) {
1449 static get is ( ) {
1550 return 'vaadin-button' ;
@@ -32,7 +67,8 @@ class Button extends ActiveMixin(TabindexMixin(FocusMixin(ElementMixin(ThemableM
3267 display : none !important ;
3368 }
3469
35- /* Ensure the button is always aligned on the baseline */
70+ /* Aligns the button with form fields when placed on the same line.
71+ Note, to make it work, the form fields should have the same "::before" pseudo-element. */
3672 . vaadin-button-container :: before {
3773 content : '\\2003' ;
3874 display : inline-block;
@@ -91,4 +127,6 @@ class Button extends ActiveMixin(TabindexMixin(FocusMixin(ElementMixin(ThemableM
91127 }
92128}
93129
130+ customElements . define ( Button . is , Button ) ;
131+
94132export { Button } ;
0 commit comments