Button
Button renders a native <button> that triggers an action: submit a form, open a dialog, confirm a choice. Pick its
weight with variant and its meaning with color; keep one contained primary action per view.When to use
- The user performs an action — save, submit, delete, open a dialog.
- The action needs a visible text label.
- The control navigates to another page — use
Link. - The control is a single icon — use
IconButton. - The content is a static label — use
LabelorText.
Usage
loadingVariants and colors
variant sets the visual weight: contained (default, solid), outlined (border only), linked (text only) and
ghost (nothing at rest, a wash on hover; meant for chrome clusters). color takes a semantic palette:
primary (default), secondary, tertiary, success, warning, danger or neutral — a quiet palette with no
brand hue, for chrome actions that must not compete with the page's primary action.
<Button variant="contained" text="Contained" /> <Button color="secondary" variant="outlined" text="Outlined" /> <Button variant="linked" text="Linked" /> <Button variant="ghost" text="Ghost" /> <Button color="neutral" variant="outlined" text="Neutral" /> <Button color="danger" text="Danger" />
Sizes
size takes extraSmall, small, medium (default) or large. fullWidth stretches the button to its container.
<Button size="extraSmall" text="extraSmall" /> <Button size="large" text="large" />
The size scale is a theme token: override theme.component.button.size.<size> (fontSize, fontWeight, py, px,
borderRadius, optional textTransform) through createTheme({ component: { button: … } }).
Icons
icon takes any node, usually an Icon. iconPosition places it left (default) or right.
<Button color="danger" icon={<Icon icon={trash} />} text="Delete" />
<Button variant="linked" icon={<Icon icon={shareAlt} />} iconPosition="right" text="Share" />Accessibility
- Renders a native
<button>: Enter and Space activate it, anddisabledis forwarded. - The label is
childrenortext(childrenwins). Give every button a visible, specific label. isLoadingswaps the content for a spinner but does not disable the button; setdisabledto block repeat submits.- Under forced colors (Windows High Contrast), the focus outline is restored with the system
Highlightcolor.
Properties
color"primary""secondary""tertiary""success""warning""danger""neutral"'primary'containmentstringnonefullWidthbooleanfalseiconReactNodenoneiconPosition"left""right"'left'isLoadingbooleanfalselegibility"on-photo"nonelineClampnumbernonepageShellbooleannonereadablenumberbooleannonesize"small""medium""large""extraSmall"'medium'textstringnonetransformstringnonevariant"contained""outlined""linked""ghost"'contained'