Content

SubText
v1.0.0
Ready for Production

A compact helper-text element for displaying secondary copy beneath form controls, with built-in size variants and danger state for validation messaging.

Prefer AI-assisted development?

This documentation is available via the Catalyst MCP Server. Learn how to connect →

Catalyst SubText is a lightweight typography primitive for rendering helper text, descriptions, and validation messages beneath form controls. It ships with three size variants, a danger state for validation error styling, and asChild composition support via Radix Slot.

Preview
SubText

Installation

npm install @pmi/catalyst-subtext
import { SubText } from '@pmi/catalyst-subtext';

Sizes

Three sizes are available: sm, md (default), and lg.

Preview
SubTextSubTextSubText

Common Patterns

Danger State

Use the danger prop to style the text as an error for validation messaging.

Preview
Text Sample

With Icon

Compose SubText with an icon using className to create informative helper text.

Preview
Text Sample

API Reference

SubText

A <span> element styled with CVA size and danger variants. Use asChild to render a custom element via Radix Slot.

Prop

Type

Accessibility

SubText is designed to support WCAG 2.2 AA compliance when used correctly.

ARIA

  • SubText renders as a <span> by default — it carries no implicit ARIA role.
  • To associate SubText with a form control, set id on the SubText and point the control's aria-describedby to that id. This ensures screen readers announce the helper or error text when the control receives focus.
  • For dynamically appearing error messages (e.g. after form submission), add aria-live="polite" so assistive technologies announce the change without disrupting the user's flow.
  • When using the danger prop, the colour change alone is not sufficient to meet WCAG 2.2 AA (SC 1.4.1 Use of Colour) — always include descriptive text that communicates the error without relying solely on colour.

Choosing the Right Component

Use SubText for secondary descriptive copy that sits visually beneath another element. Reach for a different primitive when:

If you need…Use instead
A structured error or helper message tied to a form fieldHelper Text
A visible label for a form controlLabel
A short inline text badge or status indicatorBadge

On this page