React Native / Core
Text
Themed text. Headings get the "header" role so screen readers can jump between them, and cap font scaling at 1.5x so big titles don't overflow; body text scales up to 2x with the user's font size setting.
import { Text } from "@stylhero/native";
Example
import { Stack, Text } from "@stylhero/native";
function TextExample() {
return (
<Stack gap={2}>
<Text variant="h2">Your builds</Text>
<Text>8 parts, about 140 FPS at 1440p.</Text>
<Text variant="small" tone="muted">Prices checked 2 hours ago</Text>
</Stack>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tone |
TextTone |
- | |
variant |
TextVariant |
"body" |
Type style from tokens.json. "strong" is body in bold ink. |
Also takes React Native's Text props (testID, accessibilityHint, onLayout…), passed to that Text.
Types
type TextTone = "ink" | "muted" | "primary" | "success" | "danger";
type TextVariant = TypographyToken | "strong";
type TypographyToken = keyof typeof typography;
Accessibility
h1–h3anddisplayare headers, so screen reader users can jump between sections with the headings rotor.- Follows the user's font size setting: headings up to 1.5×, body text up to 2×.
Generated from src/components/Text.tsx. Something wrong or missing? Open an issue.