Forge Developer

Beta

Forge Developer

Beta

Rate this page:

Button

Buttons are used as triggers for actions. A row of buttons is displayed in a ButtonSet.

Usage

1
import ForgeUI, { Button } from '@forge/ui';

Props

NameTypeRequiredDescription
onClick() => void | Promise<void>YesAn event handler that can be asynchronous. You can execute state updates inside this function.
textstringYesThe button's label text.
appearancestringThe appearance of the button. Valid values are danger, default, link, subtle, subtle-link, and warning. Defaults to default.
disabledbooleanWhether the user interaction is disabled. Defaults to false.

Example

A button with an asynchronous handler.

1
2
3
4
5
6
<Button
     text="Sign up"
     onClick={async () => {
       await postSignup(data);
     }}
/>

Preview

Screenshot of what the rendered button should look like

Rate this page: