ComponentsButtonLink
Version 0.10.0

ButtonLink

A button component that can be used as a link.

Usage#

import { ButtonLink } from '@backstage/ui';

<ButtonLink />

API reference#

PropTypeDefaultResponsive
variant
primarysecondary
primaryYes
size
smallmedium
mediumYes
iconStart
ReactNode
-No
iconEnd
ReactNode
-No
isDisabled
boolean
falseNo
href
string
-No
hrefLang
string
-No
target
HTMLAttributeAnchorTarget
_selfNo
rel
string
-No
children
ReactNode
-No
className
string
-No
style
CSSProperties
-No

Examples#

Variants#

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>

Sizes#

Here's a view when buttons have different sizes.

SmallMedium
<Flex align="center">
  <ButtonLink size="small">Small</ButtonLink>
  <ButtonLink size="medium">Medium</ButtonLink>
</Flex>

With Icons#

Here's a view when buttons have icons.

ButtonButtonButton
<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>

Disabled#

Here's a view when buttons are disabled.

PrimarySecondaryTertiary
<Flex gap="4">
  <ButtonLink variant="primary" isDisabled>
    Primary
  </ButtonLink>
  <ButtonLink variant="secondary" isDisabled>
    Secondary
  </ButtonLink>
</Flex>

Responsive#

Here's a view when buttons are responsive.

<ButtonLink variant={{ initial: 'primary', lg: 'secondary' }}>
  Responsive Button
</ButtonLink>

Theming#

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-ButtonLink

Changelog#

  • 0.8.0 - Add react router for internal routing for ButtonLinks #31276
  • 0.7.2 - Add react router for internal routing for ButtonLinks #31276
  • 0.6.0 - Improve Button, ButtonIcon and ButtonLink styling. #30448
  • 0.6.0 - New tertiary variant to Button, ButtonIcon and ButtonLink. #30453
  • 0.6.0 - New ButtonLink, which replaces the previous render prop pattern on Button and IconButton. #30297
  • 0.6.0 - Remove the render prop from all button-related components. #30297
  • 0.5.0 - Added a render prop to the Button component to use it as a link. #30165
  • 0.5.0 - Button, ButtonLink, ButtonIcon now default to size small instead of medium #30085, #30097