Skip to main content
Use the shared MainButton component for a prominent action. It composes Button with a solid surface, elevation, semibold text, and 12px horizontal padding. Its default color is neutral and size is md.

Usage

Visual options

Compare solid and outline appearances across default and small sizes, plus disabled and loading states.

State ownership

MainButton uses Button’s state model and adds no state of its own. Your application supplies loading and disabled; there are no controlled and uncontrolled selection modes. See Button’s state ownership example for managing an asynchronous action.

Forms and width

Width follows the content unless you set fullWidth or provide application layout styling. Override variant, color, size, and elevated as needed; for example, use variant="outline" and elevated={false} for an outlined action. Keep page layout in your application’s styling.

Interaction

MainButton accepts Button’s native attributes, event handlers, refs, icon slots, loading and disabled props. Buttons default to type="button"; set type="submit" explicitly for form submission. Use href for a link. Supply render to choose a custom root, including an application-owned router link. Set nativeButton={false} and role="link" for a navigation renderer. Custom native buttons keep nativeButton true. ButtonGroup can set a shared size, surface, and color. Explicit child appearance takes precedence over the group, followed by the component defaults. Consumer classes, including state functions, pass through to the root.

Props

string | ((state: ButtonState) => string | undefined)
CSS class applied to the element, or a function that returns a class based on the component’s state.
"accent" | "danger" | "neutral" | "success"
Semantic color of the button.
boolean
default:"true"
Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors.
ReactNode
Decorative content displayed after the label.
boolean
default:"false"
Whether the button should be focusable when disabled.
boolean
Expands the button to fill its container width.
string
Destination URL. Renders a native anchor when render is omitted unless nativeButton is explicitly true. Custom renderers retain their own element contract.
boolean
Shows a loading indicator and disables activation.
"center" | "end" | "start"
Where the loading indicator appears. center hides the content while preserving its layout space; start and end keep children and the opposite icon visible and replace the corresponding icon with the spinner.
boolean
default:"true"
Whether the rendered root is a native button. Defaults to true for custom renderers. The built-in href anchor defaults to false; an explicit value takes precedence.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>
Caller-supplied root element or renderer. Native attributes, handlers, event details, and refs reach the rendered root. Use nativeButton={false} and role="link" for a custom navigation anchor. Router integration belongs to the caller.
AriaRole
Role of the root element. Use link for custom navigation renderers.
ShortcutDefinition
Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens.
string
Localized text between sequence steps. Defaults to then.
"md" | "sm"
Button height: sm (24px) or md (32px). The link variant uses its content height at either size.
ReactNode
Decorative content displayed before the label.
CSSProperties | ((state: ButtonState) => CSSProperties | undefined)
Style applied to the element, or a function that returns a style object based on the component’s state.
"ghost" | "link" | "outline" | "soft" | "solid"
default:"solid"
Visual treatment of the button surface. link uses compact text styling without a filled surface or border; render composition determines native semantics.