Triggers an action. Renders the Rocketlane Button inside a custom element.

<rl-button variant="primary">Button</rl-button>
<rl-button variant="secondary">Button</rl-button>

Usage

Use rl-button after rliSdk.init(). Listen for the native click event that bubbles from the inner button.

tsx
<rl-button variant="primary" onClick={() => console.log("saved")}>
Save
</rl-button>

Examples

Primary

<rl-button variant="primary">Primary</rl-button>

Secondary

<rl-button variant="secondary">Secondary</rl-button>

Ghost

<rl-button variant="ghost">Ghost</rl-button>

Danger

<rl-button variant="danger">Delete</rl-button>

Size

Use the size attribute.

<rl-button size="small">Small</rl-button>
<rl-button size="medium">Medium</rl-button>
<rl-button size="large">Large</rl-button>

Disabled

<rl-button variant="primary" disabled>Disabled</rl-button>

Loading

<rl-button variant="primary" loading>Saving</rl-button>

With click handler

tsx
<rl-button
variant="primary"
onClick={() => {
  // runs when the button is activated
}}
>
Save
</rl-button>

API

Props

PropTypeDefaultDescription
variant"primary" | "secondary" | "ghost" | "link" | "success" | "danger" | "tertiary" | "ai" | …"secondary"Visual style.
size"small" | "medium" | "large""medium"Control height.
disabledbooleanfalsePrevents interaction.
loadingbooleanfalseShows a loading state.
type"button" | "submit" | "reset""button"Native button type.

Events

EventTypeDescription
clickMouseEventBubbles from the inner button when activated. Use React onClick on the host, or addEventListener("click", …) in Vanilla JS.