Skip to main content

Button

Use cases:

  • Submit forms
  • Trigger actions
  • Create interactive elements
  • Set options

Example​

Default ButtonPrimary Color ButtonSecondary Color ButtonButton with start slotButton with end slotDisabled Button

Declaration

<Button>Button</Button>

Usage

import { Button, Icon } from '@genesislcap/rapid-design-system/react';

export function MyComponent() {
const handleButtonClicked = (event) => {
console.log('Button clicked')
};

return (
<Button
onClick={handleButtonClicked}>
Default Button
</Button>
<Button
onClick={handleButtonClicked}
appearance="primary">
Primary Color Button
</Button>
<Button
onClick={handleButtonClicked}
appearance="secondary">
Secondary Color Button
</Button>
<Button>
<Icon
onClick={handleButtonClicked}
name="plus"
slot="start">
</Icon>
Button with start slot
</Button>
<Button>
Button with end slot
<Icon
name="warning"
slot="end">
</Icon>
</Button>
<Button disabled>
Disabled Button
</Button>
);
}

API​

Property and attribute binding examples for Genesis Component syntax. Closing tag omitted.

NameTypeDescriptionExample
autofocusbooleanThe boolean value of whether the button is checked.
<rapid-button autofocus>
disabledbooleanMakes the component visually opaque, and configures it so that the user cannot alter the state via the web browser.
<rapid-button disabled>
formstringAssociates this component with a form. The Form id must be passed. If no Id is passed, then it will be associated with the ancestor form.
<rapid-button form="myForm">
namestringDefines the name of the element.
<rapid-button name="buttonName">
typestringDefines the mode of the button. button (default) - performs an action when clicked | reset - can influence a group of components associated with the same form)
<rapid-button type="button">
valuestringDefines the value associated with this button.
<rapid-button value="sample">

Properties

This component doesn't have any properties which are not also controlled via attributes.

Slots​

SlotUse
startStart slot.
endEnd slot.

Parts​

PartDescription
controlThe button element.
contentThe element wrapping button content.

Events fired​

EventUse
clickEmits a change event when the button is pressed

Events listened to​

This component doesn't listen to any events.

Further details​

This component is an implementation of an HTML button element.