- Docs
- Components
- Type
Text
Running text, labels and inline code, on the type roles: a size, a weight and a tone from the tokens.
- Import
- @qeetrix/react
- Status
- StableSince 0.0.2
- Renders
<span>Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Import
// From the package: a build keeps only what it uses.
import { Text } from "@qeetrix/react";
// Or from its own path.
import { Text } from "@qeetrix/react/text";02
Props
And every native attribute of the element it renders.
| Prop | Type | Default | What it does |
|---|---|---|---|
size | "sm" | "md" | "lg" | "md" | 12/16, 14/20 or 16/24. |
weight | "regular" | "medium" | "semibold" | "regular" | 400, 500 or 600. |
tone | "default" | "subtle" | "subtlest" | "disabled" | "inverse" | "brand" | "danger" | "success" | "warning" | "info" | inherit | A text colour; disabled only inside an inactive control. |
mono | boolean | false | Fira Code at the same size. |
truncate | boolean | number | — | One line with an ellipsis, or a number of lines. |
align | "start" | "center" | "end" | — | Logical alignment. |
render | ReactElement | a <span> | A <p>, a <label>. |
03
Parts
Each part carries a data-slot, for tests and placement.
| data-slot | Element | What it is |
|---|---|---|
text | <span> | data-size, data-weight, data-tone. |
04
Numbers
Format them for the locale with the library's helpers.
import { formatNumber } from "@qeetrix/react";
<Text>{formatNumber(1284, "en-IN")} users</Text>