Text provides an ergonomic API for rendering text. It includes built-in support for Canvas type tokens.

yarn add @workday/canvas-kit-react
yarn add @workday/canvas-kit-react

Usage Guidance

Coming soon!


Basic Example

Text is built on top of Box and supports a multitude of style props including spacing props such as margin and padding, as well as text styling props such as fontSize and fontWeight.

Text renders a <span> element by default. You may override the rendered element using the as prop.

Text as h4

Text styled using style props

Text styled using type token level

Text with inherited styles

Type Level and Variant

Text includes built-in support for Canvas type tokens via the typeLevel and variant props.

typeLevel hooks into the Canvas type hierarchy.

Small Body level text

variant allows you to layer additional styling to aid users' understanding of the text being rendered.

Error text

Component API


This is a generic base component intended to render any text. It's built on top of the component. It also has typeLevel and variant style props that simplify navigating our type hierarchy and using Canvas type tokens. By default, it renders a semantic span element, but you can adjust this as needed with the as prop.

The type hierarchy is organized into four levels, which correspond to our Canvas type levels.

  • title: Intended to be used for large page titles.
  • heading: Intended to be used for headings and large text.
  • body: Intended to be used for standard body text.
  • subtext: Intended to be used for small subtext content or in tight spaces.

Each level has three sizes: large, medium, and small.

You can provide any level and size to the typeLevel prop, and it will apply the correct styles accordingly. In the example below we're providing the subtext level and small size to the component with the value subtext.small.

import { Text } from '@workday/canvas-kit-react/text';
const CustomErrorText = () => (
<Text typeLevel="subtext.small" variant="error">
Error Text

Layout Component

Text supports all props from thelayout component.


Props extend from span. Changing the as prop will change the element interface.


Type token as string with level and size separated by dot. These values map to our Canvas type levels.

<Text typeLevel="body.small">Small body text</Text>

Type variant token names: error, hint or inverse.

<Text variant="error" typeLevel="subtext.large">Error text</Text>

Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using React.forwardRefand spread extra props to a root element.

Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care.


Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If as is set to an element, it will be that element. If as is a component, the reference will be to that component (or element if the component uses React.forwardRef).

Can't Find What You Need?

Check out our FAQ section which may help you find the information you're looking for.

FAQ Section