Version 0.11.2

Text

Typography component with variants, weights, colors, and semantic elements.

This is a text component

Usage#

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

<Text>This is a text component</Text>

API reference#

PropTypeDefaultDescription
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
primarysecondarydangerwarningsuccess
primaryText color. Status colors (danger, warning, success) for contextual messaging.
as
h1h2h3h4h5h6pspanlabeldivstrongemsmalllegend
spanHTML element to render. Use heading tags for semantic structure.
truncate
boolean
falseTruncates text with ellipsis when it overflows its container. Requires display: block to work.
children
ReactNode
-
className
string
-Additional CSS class name for custom styling.
style
CSSProperties
-Inline CSS styles object.

Examples#

Variants#

Title LargeTitle MediumTitle SmallTitle X-SmallBody LargeBody MediumBody SmallBody X-Small

Weights#

Regular weightBold weight

Colors#

Status colors for contextual messaging.

PrimarySecondaryDangerWarningSuccessInfo

Truncate#

This is a very long text that will be truncated when it exceeds the container width

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-Text
  • bui-Text[data-variant="subtitle"]
  • bui-Text[data-variant="body"]
  • bui-Text[data-variant="caption"]
  • bui-Text[data-variant="label"]
  • bui-Text[data-weight="regular"]
  • bui-Text[data-weight="bold"]
  • bui-Text[data-color="primary"]
  • bui-Text[data-color="secondary"]
  • bui-Text[data-color="danger"]
  • bui-Text[data-color="warning"]
  • bui-Text[data-color="success"]
  • bui-Text[data-color="info"]
  • bui-Text[data-truncate="true"]
  • bui-Text[data-truncate="false"]

Changelog#

Version 0.9.0#

Changes

  • Fix default text color in Backstage UI #31429

  • Fixed Text component to prevent truncate prop from being spread to the underlying DOM element. #31615