A button component that can be used as a link.
import { ButtonLink } from '@backstage/ui';
<ButtonLink />| Prop | Type | Default | Responsive |
|---|---|---|---|
| variant | primarysecondary | primary | Yes |
| size | smallmedium | medium | Yes |
| iconStart | ReactNode | - | No |
| iconEnd | ReactNode | - | No |
| isDisabled | boolean | false | No |
| href | string | - | No |
| hrefLang | string | - | No |
| target | HTMLAttributeAnchorTarget | _self | No |
| rel | string | - | No |
| children | ReactNode | - | No |
| className | string | - | No |
| style | CSSProperties | - | No |
Here's a view when buttons have different variants.
<Flex align="center">
<ButtonLink iconStart={<Icon name="cloud" />} variant="primary">
Button
</ButtonLink>
<ButtonLink iconStart={<Icon name="cloud" />} variant="secondary">
Button
</ButtonLink>
</Flex>Here's a view when buttons have different sizes.
<Flex align="center">
<ButtonLink size="small">Small</ButtonLink>
<ButtonLink size="medium">Medium</ButtonLink>
</Flex>Here's a view when buttons have icons.
<Flex align="center">
<ButtonLink iconStart={<Icon name="cloud" />}>Button</ButtonLink>
<ButtonLink iconEnd={<Icon name="chevronRight" />}>Button</ButtonLink>
<ButtonLink
iconStart={<Icon name="cloud" />}
iconEnd={<Icon name="chevronRight" />}>
Button
</ButtonLink>
</Flex>Here's a view when buttons are disabled.
<Flex gap="4">
<ButtonLink variant="primary" isDisabled>
Primary
</ButtonLink>
<ButtonLink variant="secondary" isDisabled>
Secondary
</ButtonLink>
</Flex>Here's a view when buttons are responsive.
<ButtonLink variant={{ initial: 'primary', lg: 'secondary' }}>
Responsive 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-ButtonLink0.6.0 - Improve Button, ButtonIcon and ButtonLink styling. #304480.6.0 - New tertiary variant to Button, ButtonIcon and ButtonLink. #304530.6.0 - New ButtonLink, which replaces the previous render prop pattern on Button and IconButton. #302970.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, #30097