TextView for composed text in a custom layout. Select the typography with textStyle, the semantic color role with textColor, and the appropriate HTML semantics with as.import {TextColor, TextStyle, TextView} from '@wearables-ui-toolkit/mrbd';
function TrailSummary() {
return (
<div className="trail-summary">
<TextView as="h2" textStyle={TextStyle.BODY2_EMPHASIZED}>
Trail conditions
</TextView>
<TextView as="p" textStyle={TextStyle.BODY2}>
The north overlook is open.
</TextView>
<TextView
as="p"
textStyle={TextStyle.META2}
textColor={TextColor.SECONDARY}>
UPDATED JUST NOW
</TextView>
</div>
);
}
.trail-summary {
display: grid;
gap: var(--uit-spacing-med-lg);
}
TextView can provide the id for an ARIA relationship. This keeps the visible heading and accessible section name connected:import type {ReactNode} from 'react';
import {TextColor, TextStyle, TextView} from '@wearables-ui-toolkit/mrbd';
function RouteSection({children}: {children: ReactNode}) {
return (
<section aria-labelledby="route-heading">
<TextView
id="route-heading"
as="h3"
textStyle={TextStyle.LABEL_EMPHASIZED}>
Route
</TextView>
<TextView
as="p"
textStyle={TextStyle.META1}
textColor={TextColor.SECONDARY}>
{children}
</TextView>
</section>
);
}
TextViewProps. It extends HTMLAttributes<HTMLSpanElement> without color, and this attribute set remains the same for every element selected by as. Props not listed below, including id, aria-*, data-*, role, tabIndex, title, and DOM event handlers, are forwarded to the rendered element. The ref is forwarded to the same element.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Text content to display. |
textStyle | TextStyle | TextStyle.BODY1 | Typography appearance applied to the content. |
textColor | TextColor | TextColor.PRIMARY | Semantic foreground color applied to the content. |
as | 'span' \| 'p' \| 'div' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'label' | 'span' | HTML element rendered by the component. |
className | string | '' | Class appended after the component’s own classes. |
style | CSSProperties | {} | Styles merged after the resolved color, so they take precedence over it. |
TextStyle selects a complete typography appearance. Its members are:NUMERAL1, NUMERAL2, DISPLAY1, HEADING1, HEADING2, BODY1, BODY1_EMPHASIZED, BODY2, BODY2_EMPHASIZED, LABEL, LABEL_EMPHASIZED, META1, META1_EMPHASIZED, META2, META2_EMPHASIZED, META3.TextAppearance constant and public typography class. See Typography for each appearance, recommended use, and class name. Custom markup that cannot use TextView can apply the same appearance class directly. A TextAppearance constant is a CSS class for an ordinary element; do not pass it as textStyle because that prop requires a TextStyle member.TextColor selects a semantic foreground token.TextColor member | Color token |
|---|---|
PRIMARY | --uit-color-text-primary |
SECONDARY | --uit-color-text-secondary |
PLACEHOLDER | --uit-color-text-placeholder |
ACTIVE_HOVER | --uit-color-text-active-hover |
ACCENT | --uit-color-text-accent |
TextView writes the token selected by textColor as the rendered element’s inline color. Descendants inherit that value, and an icon painted with currentColor matches the text. The caller’s style object is merged afterward, so an explicit color in style takes precedence.TextColor.SECONDARY also applies the uit-color-text-secondary class. This class provides both the semantic token and the lighten blend required by the additive-light display. The blend uses !important, so inline mixBlendMode cannot remove it. The secondary token without this class produces an incorrect display result.span, so adjacent default text views share a line and have no automatic separation. For stacked text, prefer block elements such as as="p" or a heading, with an explicit column layout and spacing tokens. TextView sizes to its content and does not provide truncation, ellipsis, clamping, or a line limit. Use ReadMoreTextView when content requires a line limit.className. Use the caller class for layout, spacing, and wrapping. Avoid using it to override the appearance class, because CSS specificity does not guarantee that result.as but is typed as HTMLSpanElement. Cast it when the caller requires the more specific element type.style objects and stable children so it can skip unnecessary renders; an inline object literal creates a new reference on each render.as from the document structure the content needs, rather than from its visual appearance. Pairing a heading element with a body appearance is a supported and typically preferred way to preserve the page outline.TextView adds no role or accessible name. The application owns the semantics and accessible relationships for the rendered text.id, aria-*, data-*, role, and tabIndex props allow the text to participate in relationships such as aria-labelledby and aria-describedby.TextViewProps does not include htmlFor, so as="label" cannot associate the component with a form control through that attribute. Use aria-labelledby, or render a native <label> and apply the appearance class directly, so the control receives an accessible label.aria-hidden by the application so assistive technology does not announce it. TextView does not hide content automatically.textStyle to each text view so its role remains clear if the default changes or the composition evolves.as="p" and heading elements with a column layout and spacing tokens for stacked text. This gives the application predictable semantics and spacing.className for layout, spacing, and wrapping, and use component props for appearance and semantic color.mixBlendMode. The additive-light display requires both parts.style.