Text
Text on the system's type scale.
Text is the system’s type scale. It’s the only place that sets font size, weight, family,
line height or tracking. Every other component styles its text with textVariants, the same
scale as a class string. The sync check fails when a component, block or example sets a size or
weight itself.
It renders a <p>. Give it render for another element, like <span /> inside a sentence.
For headings, put textVariants on the heading itself, so the heading keeps its content where
accessibility checks can see it. Without size, text inherits the size around it.
Sizes
Each step sets a line height to match. control is for form fields: md on narrow screens, so
iOS doesn’t zoom into a focused field, then sm.
Weights and families
Dependencies
What it's built from and what's built from it in Base, read from the imports in its source.
| Uses | Nothing else in the system. |
|---|---|
| Used by | AccordionAlertAlert DialogAvatarBadgeBreadcrumbButtonprimitiveCardConversationblockDialogEmptyFieldform itemFile Drop Zoneform itemFooterblockForm SectionblockInputform itemKbdLabelform itemMenuMenubarNav SheetblockPanel NavblockPopoverProgressSegmented Controlform itemSelectform itemSheetSidebarSliderform itemTableTabsTextareaform itemToastToggleTooltipWorkspaceblock |
| Packages | @ui-sdk/core@0.1.0-beta.20@ui-sdk/react@0.1.0-beta.20tailwind-variants@4.1.0 |
Installation
Set the project up for Base once first, as Getting started shows. Then add it with the CLI, or by hand.
With the CLI
Manually
Install its packages:
Then copy the source:
API reference
Generated from Base's types. Props marked ours are added here; the rest come from the ui-sdk part it wraps. Every part also accepts its element's native attributes.
Text
Text on the system's type scale. A <p> unless render gives another element.
- capsours
Type boolean
- familyours
The font. Inherits it when unset, which is usually the body font.
Type NonNullable<"body" | "heading" | "mono">
- leadingours
Type NonNullable<"none" | "tight" | "snug" | "relaxed">
- renderours
The element to render instead of a
<p>, like<h2 />or<span />.Type RenderProp
- sizeours
A step on the type scale. Inherits the size around it when unset.
Type NonNullable<"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "control">
- tabularours
Type boolean
- toneours
Type NonNullable<"default" | "muted" | "primary" | "destructive" | "warning" | "success">
- truncateours
Type boolean
- weightours
Type NonNullable<"normal" | "medium" | "semibold">
textSizes
The size names, smallest first, then control.
Takes the props of a native div.