A button component that can be used to trigger actions.
import { Button } from '@backstage/ui';
<Button />
Prop | Type | Default | Responsive |
---|---|---|---|
variant | primarysecondary | primary | Yes |
size | smallmedium | medium | Yes |
iconStart | ReactNode | - | No |
iconEnd | ReactNode | - | No |
isDisabled | boolean | false | No |
children | ReactNode | - | No |
type | buttonsubmitreset | button | No |
className | string | - | No |
style | CSSProperties | - | No |
Here's a view when buttons have different variants.
<Flex align="center">
<Button iconStart="cloud" variant="primary">
Button
</Button>
<Button iconStart="cloud" variant="secondary">
Button
</Button>
</Flex>
Here's a view when buttons have different sizes.
<Flex align="center">
<Button size="small">Small</Button>
<Button size="medium">Medium</Button>
</Flex>
Here's a view when buttons have icons.
<Flex align="center">
<Button iconStart={<Icon name="cloud" />}>Button</Button>
<Button iconEnd={<Icon name="chevronRight" />}>Button</Button>
<Button iconStart={<Icon name="cloud" />} iconEnd={<Icon name="chevronRight" />}>Button</Button>
</Flex>
Here's a view when buttons are disabled.
<Flex gap="4">
<Button variant="primary" isDisabled>
Primary
</Button>
<Button variant="secondary" isDisabled>
Secondary
</Button>
</Flex>
Here's a view when buttons are responsive.
<Button variant={{ initial: 'primary', lg: 'secondary' }}>
Responsive Button
</Button>
If you want to use a button as a link, please use the ButtonLink
component.
import { ButtonLink } from '@backstage/ui';
<ButtonLink href="https://ui.backstage.io" target="_blank">
Button
</ButtonLink>
Our theming system is based on a mix between CSS classes, CSS variables and data attributes. If you want to customise this component, you can use one of these class names below.
bui-Button
bui-Button[data-size="small"]
bui-Button[data-size="medium"]
bui-Button[data-size="large"]
bui-Button[data-variant="primary"]
bui-Button[data-variant="secondary"]
bui-Button[data-variant="tertiary"]
0.6.0
- Improve Button
, ButtonIcon
and ButtonLink
styling. #304480.6.0
- New tertiary
variant to Button
, ButtonIcon
and ButtonLink
. #304530.6.0
- Remove the render
prop from all button-related components. #302970.5.0
- Added a render prop to the Button
component to use it as a link. #301650.5.0
- Button
, ButtonLink
, ButtonIcon
now default to size small
instead of medium
#30085, #300970.4.0
- Improve icon props on Button
and IconButton
#296670.2.0
- Improve Button
& Checkbox
styles #29127, #287890.2.0
- Improve Button
types #29205