gov-button
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
color | color | Style variation of the button | "error" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined |
disabled | disabled | Makes the button component disabled. This prevents users from being able to interact with the button, and conveys its inactive state to assistive technologies | boolean | false |
download | download | Same as original parameter | boolean | undefined |
expanded | expanded | Expands the button to fill 100% of the container width | boolean | false |
expandedMobile | expanded-mobile | Expands the button to fill 100% of the container width only on mobile | boolean | false |
focusable | focusable | Same as original parameter | boolean | true |
href | href | Same as original parameter | string | undefined |
hreflang | hreflang | Same as original parameter | string | undefined |
identifier | identifier | Custom button identifier | string | undefined |
loading | loading | Indicates whether an asynchronous process is running | string | undefined |
name | name | The name of the button, which gets paired with the button's value when submitted as part of a form. Corresponds with the native HTML name attribute | string | undefined |
nativeType | native-type | Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type | "button" | "reset" | "submit" | "button" |
referrerpolicy | referrerpolicy | Same as original parameter | string | undefined |
rel | rel | Same as original parameter | string | undefined |
size | size | Button’s size | "l" | "m" | "s" | "xl" | "xs" | "m" |
tab | tab | Same as original parameter | number | 0 |
target | target | Same as original parameter | "_blank" | "_new" | "_self" | undefined |
type | type | Button's type | "base" | "link" | "outlined" | "solid" | undefined |
Events
| Event | Description | Type |
|---|---|---|
gov-blur | Emitted when the button loses focus | CustomEvent<ButtonEvent> |
gov-click | Emitted when the button click | CustomEvent<ButtonEvent> |
gov-focus | Emitted when the button has focus | CustomEvent<ButtonEvent> |
Methods
getRef() => Promise<HTMLLinkElement | HTMLButtonElement>
Returns a clickable element instance
Returns
Type: Promise<HTMLLinkElement | HTMLButtonElement>
setFocus() => Promise<void>
Focus button element
Returns
Type: Promise<void>
validateAccessibility() => Promise<void>
Validate the Accessibility attributes of the component
Returns
Type: Promise<void>
Dependencies
Used by
- gov-attachments-item
- gov-breadcrumbs
- gov-collapsible
- gov-cookiebar
- gov-dialog
- gov-form-input
- gov-form-multi-select
- gov-infobar
- gov-pagination
- gov-toast
- gov-tooltip-content
- gov-user-navigation
Depends on
Graph
Built with StencilJS