BankaiText

A polymorphic text primitive. Pick the element with as (including inline semantics like code/kbd/mark) and style with size/weight/tone — each a named set plus a verbatim escape hatch.

Example

Heading (2xl / bold)Body text at the default weight.Muted small print.Subtle small print. Inline semantics: press ⌘K to highlight some code.

Props

PropTypeDefaultDescription
asBankaiTextElement | string'span'Element to render as. Polymorphic — suggests the phrasing/text elements (BankaiTextElement); any tag string (e.g. a custom element) is also accepted. Use an inline-semantic element ('strong', 'em', 'mark', 'code', 'kbd', 'del', …) to carry that meaning natively.
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | stringType size. A named xs–2xl step (--bankai-text-size-*) reflects as data-bankai-size; any other string is a verbatim CSS font-size. Omitted when unset (inherits the ambient font size).
weight'thin' … 'black' | number | stringFont weight. A named step (BankaiTextWeight) reflects as data-bankai-weight; a number or any other string ('var(--wght)', 'calc(…)', 'lighter') is a verbatim font-weight — a variable font renders a numeric value along its wght axis. Omitted when unset (inherits the ambient weight).
tone'default' | 'muted' | 'subtle' | stringText tone. A named neutral tone reflects as data-bankai-tone; any other string is a verbatim CSS color. Omitted when unset (inherits the ambient color).
truncatebooleanfalseTruncate overflowing text to a single line with an ellipsis. Reflected on the root as data-bankai-truncate. The theme rule makes the element block-level, so it truncates against the available width.

Emits

This component emits no events.

Slots

SlotDescription
defaultText content.

Exposes

This component exposes nothing on its instance.

Theming

Every token is a :root custom property applied through zero-specificity :where() rules, so a single plain declaration overrides one — no selector, no !important. Set it globally on :root or locally on any ancestor.

TokenDefaultPurpose
--bankai-text-colorvar(--bankai-color-fg)Default text color.
--bankai-text-color-mutedvar(--bankai-color-fg-muted)Color of the muted tone.
--bankai-text-color-subtlevar(--bankai-color-fg-subtle)Color of the subtle tone.
--bankai-text-line-height-xs1remLine height paired with the xs size step.
--bankai-text-line-height-sm1.25remLine height paired with the sm size step.
--bankai-text-line-height-md1.5remLine height paired with the md size step.
--bankai-text-line-height-lg1.75remLine height paired with the lg size step.
--bankai-text-line-height-xl1.75remLine height paired with the xl size step.
--bankai-text-line-height-2xl2remLine height paired with the 2xl size step.