@@ -4,18 +4,75 @@ import {CartLineItemApi} from './cart-line/cart-line-item';
44import { FullPageApi } from '../extension-targets' ;
55
66interface ButtonProps {
7+ /**
8+ * A label that describes the purpose or contents of the Button. It will be read to users using assistive technologies such as screen readers.
9+ *
10+ * Use this when using only an icon or the button text is not enough context
11+ * for users using assistive technologies.
12+ */
713 accessibilityLabel ?: string ;
814 command ?: '--auto' | '--toggle' | '--copy' ;
915 commandFor ?: string ;
16+ /**
17+ * Disables the button, disallowing any interaction.
18+ *
19+ * @defaultValue false
20+ */
1021 disabled ?: boolean ;
22+ /**
23+ * The URL to link to.
24+ *
25+ * - If set, it will navigate to the location specified by `href` after executing the `onClick` callback.
26+ * - If a `commandFor` is set, the `command` will be executed instead of the navigation.
27+ */
1128 href ?: string ;
1229 id ?: string ;
30+ /**
31+ * Replaces content with a loading indicator.
32+ *
33+ * @defaultValue false
34+ */
1335 loading ?: boolean ;
36+ /**
37+ * Specifies where to display the linked URL
38+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
39+ *
40+ * 'auto' - The target is automatically determined based on the origin of the URL. Surfaces can set specific rules on how they handle each URL.
41+ * It’s expected that the behavior of `auto` is as `_self` except in specific cases.
42+ * For example, a surface could decide to open cross-origin URLs in a new window (as `_blank`).
43+ *
44+ * @default 'auto'
45+ */
1446 target ?: 'auto' | '_self' | '_blank' ;
47+ /**
48+ * Sets the tone of the Button, based on the intention of the information being conveyed.
49+ *
50+ * @default 'auto'
51+ */
1552 tone ?: 'auto' | 'neutral' | 'critical' ;
53+ /**
54+ * The behavior of the button.
55+ *
56+ * - `'submit'` - Used to indicate the component acts as a submit button, meaning it submits the closest form.
57+ * - `'button'` - Used to indicate the component acts as a button, meaning it has no default action.
58+ * - `'reset'` - Used to indicate the component acts as a reset button, meaning it resets the closest form (returning fields to their default values).
59+ *
60+ * This property is ignored if the component supports `href` or `commandFor`/`command` and one of them is set.
61+ *
62+ * @default 'button'
63+ */
1664 type ?: 'button' | 'submit' ;
65+ /**
66+ * Changes the visual appearance of the Button.
67+ *
68+ * @default 'auto' - the variant is automatically determined by the Button's context
69+ */
1770 variant ?: 'auto' | 'primary' | 'secondary' ;
1871
72+ /**
73+ * Callback when the button is activated.
74+ * This will be called before the action indicated by `type`.
75+ */
1976 onClick ?( ) : void ;
2077}
2178
0 commit comments