Version 0.13.2

Link

A styled anchor with typography variants, colors, and weights.

Usage#

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

<Link href="/">Sign up for Backstage</Link>

API reference#

PropTypeDefaultDescription
href
string
-URL the link navigates to. Supports internal and external URLs.
target
_self_blank_parent_top
-Where to open the link. Use _blank for external links that open in new tabs.
title
string
-Tooltip text shown on hover. Useful for accessibility.
variant
title-largetitle-mediumtitle-smalltitle-x-smallbody-largebody-mediumbody-smallbody-x-small
body-mediumTypography style. Title variants for headings, body for paragraph text.
weight
regularbold
regularFont weight. Use bold for emphasis.
color
primarysecondarydangerwarningsuccessinfo
primaryText color. Status colors (danger, warning, success) for contextual links.
truncate
boolean
falseTruncates text with ellipsis when it overflows its container.
noTrack
boolean
-Suppresses the automatic analytics click event, e.g. if you already have custom tracking.
standalone
boolean
falseRemoves underline by default. Underline appears on hover.
children
ReactNode
-
className
string
-Additional CSS class name for custom styling.
style
CSSProperties
-Inline CSS styles object.

Inherits all React Aria Link props.

Examples#

Use target="_blank" to open links in a new tab.

<Link href="#" target="_blank">
  Sign up for Backstage
</Link>

Variants#

Colors#

Status colors for contextual links.

Weight#

<Flex gap="4">
  <Link href="#" weight="regular">Regular</Link>
  <Link href="#" weight="bold">Bold</Link>
</Flex>

Standalone#

Use standalone to remove the underline by default. The underline will appear on hover.

<Flex gap="4">
  <Link href="#">Default link</Link>
  <Link href="#" standalone>Standalone link</Link>
</Flex>

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

Changelog#

Version 0.13.0#

Breaking Changes

  • Breaking Centralized client-side routing in BUIProvider. Components like Link, ButtonLink, Tabs, Menu, TagGroup, and Table now require a BUIProvider rendered inside a React Router context for client-side navigation to work. #33267

    Migration Guide:

    This change requires updating @backstage/plugin-app and @backstage/core-app-api alongside @backstage/ui. If you only upgrade @backstage/ui, BUI components will fall back to full-page navigation.

    If you cannot upgrade all packages together, or if you have a custom app shell, add a BUIProvider inside your Router:

    + import { BUIProvider } from '@backstage/ui';
    
      <BrowserRouter>
    +   <BUIProvider>
          <AppContent />
    +   </BUIProvider>
      </BrowserRouter>
    

Changes

  • Added analytics capabilities to the component library. Components with navigation behavior (Link, ButtonLink, Tab, MenuItem, Tag, Row) now fire analytics events on click when a BUIProvider is present.

    New exports: BUIProvider, useAnalytics, getNodeText, and associated types (AnalyticsTracker, UseAnalyticsFn, BUIProviderProps, AnalyticsEventAttributes).

    Components with analytics support now accept a noTrack prop to suppress event firing. #33150

  • Migrated all components from useStyles to useDefinition hook. Exported OwnProps types for each component, enabling better type composition for consumers. #33050

  • Fixed Link variant default from 'body' to 'body-medium' to match actual CSS selectors. The previous default did not correspond to a valid variant value. #33050

Version 0.12.0#

Breaking Changes

  • Breaking Removed link and tint color tokens, added new status foreground tokens, and improved Link component styling

    The following color tokens have been removed:

    • --bui-fg-link (and all related tokens: -hover, -pressed, -disabled)
    • --bui-fg-tint (and all related tokens: -hover, -pressed, -disabled)
    • --bui-bg-tint (and all related tokens: -hover, -pressed, -disabled)
    • --bui-border-tint (and all related tokens)

    New Status Tokens:

    Added dedicated tokens for status colors that distinguish between usage on status backgrounds vs. standalone usage:

    • --bui-fg-danger-on-bg / --bui-fg-danger
    • --bui-fg-warning-on-bg / --bui-fg-warning
    • --bui-fg-success-on-bg / --bui-fg-success
    • --bui-fg-info-on-bg / --bui-fg-info

    The -on-bg variants are designed for text on colored backgrounds, while the base variants are for standalone status indicators with improved visibility and contrast. #32608

    Migration Guide:

    For link colors, migrate to one of the following alternatives:

    .custom-link {
    - color: var(--bui-fg-link);
    + color: var(--bui-fg-info);  /* For informational links */
    + /* or */
    + color: var(--bui-fg-primary);  /* For standard text links */
    }
    

    For tint colors (backgrounds, foregrounds, borders), migrate to appropriate status or neutral colors:

    .info-section {
    - background: var(--bui-bg-tint);
    + background: var(--bui-bg-info);  /* For informational sections */
    + /* or */
    + background: var(--bui-bg-neutral-1);  /* For neutral emphasis */
    }
    

    If you're using status foreground colors on colored backgrounds, update to the new -on-bg tokens:

    .error-badge {
    - color: var(--bui-fg-danger);
    + color: var(--bui-fg-danger-on-bg);
      background: var(--bui-bg-danger);
    }
    

Changes

  • Fixed components to not require a Router context when rendering without internal links. #32373

Version 0.9.0#

Changes

  • Improved the Link component structure in Backstage UI. #31524