Button
Installation
Learn more about how to install on our getting started docs.
<script type="module">
import '@rhds/elements/rh-button/rh-button.js';
</script>
Import Map Example
<script type="importmap">
{
"imports": {
"@rhds/elements/": "https://www.redhatstatic.com/dx/v1-alpha/@rhds/elements@2.0.1/elements/",
}
}
</script>
npm install @rhds/elements
<script type="module">
import '@rhds/elements/rh-button/rh-button.js';
</script>
<script type="module">
import '@rhds/elements/rh-button/rh-button.js';
</script>
Import Map Example
<script type="importmap">
{
"imports": {
"@rhds/elements/rh-button/rh-button.js": "./elements/rh-button/rh-button.js"
},
"scopes": {
"./": {
"@patternfly/pfe-core/": "https://ga.jspm.io/npm:@patternfly/pfe-core@4.0.2/",
"@patternfly/pfe-core/ssr-shims.js": "https://ga.jspm.io/npm:@patternfly/pfe-core@4.0.2/core.js",
"@rhds/elements/rh-icon/rh-icon.js": "./elements/rh-icon/rh-icon.js",
"@rhds/icons": "https://ga.jspm.io/npm:@rhds/icons@1.1.2/icons.js",
"@rhds/tokens/css/color-context-consumer.css.js": "https://ga.jspm.io/npm:@rhds/tokens@2.1.0-next.15/css/color-context-consumer.css.js",
"lit": "https://ga.jspm.io/npm:lit@3.2.0/index.js",
"lit/": "https://ga.jspm.io/npm:lit@3.2.0/",
"tslib": "https://ga.jspm.io/npm:tslib@2.7.0/tslib.es6.mjs"
},
"https://ga.jspm.io/": {
"@lit/reactive-element": "https://ga.jspm.io/npm:@lit/reactive-element@2.0.4/development/reactive-element.js",
"@lit/reactive-element/decorators/": "https://ga.jspm.io/npm:@lit/reactive-element@2.0.4/development/decorators/",
"@patternfly/pfe-core/controllers/property-observer-controller.js": "https://ga.jspm.io/npm:@patternfly/pfe-core@4.0.2/controllers/property-observer-controller.js",
"lit": "https://ga.jspm.io/npm:lit@3.2.0/index.js",
"lit-element/lit-element.js": "https://ga.jspm.io/npm:lit-element@4.1.0/development/lit-element.js",
"lit-html": "https://ga.jspm.io/npm:lit-html@3.2.0/development/lit-html.js",
"lit-html/": "https://ga.jspm.io/npm:lit-html@3.2.0/development/",
"tslib": "https://ga.jspm.io/npm:tslib@2.7.0/tslib.es6.mjs"
}
}
}
</script>
Usage
rh-button
| Slot Name | Description |
|---|---|
icon |
Contains the button's icon or state indicator, e.g. a spinner. |
|
Contains button text |
| DOM Property | Description | Type | Default |
|---|---|---|---|
disabled |
Disables the button |
|
|
type |
button type |
|
|
label |
Accessible name for the button, use when the button does not have slotted text |
|
|
value |
Form value for the button |
|
|
name |
Form name for the button |
|
|
icon |
Shorthand for the |
|
|
iconSet |
Icon set for the |
|
|
variant |
Changes the style of the button.
|
|
|
danger |
Use danger buttons for actions a user can take that are potentially destructive or difficult/impossible to undo, like deleting or removing user data. |
|
|
| Method Name | Description |
|---|---|
focus() |
None
| Part Name | Description |
|---|---|
button |
Internal button element |
icon |
Container for the icon slot |
None
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.