# React Native Text and Heading

> React Native Text and Heading components for iOS, Android and the web: the theme's type scale, weights, font roles (tabular numbers) and colors, and semantic headings that screen readers and the web's h1–h4 understand.

# Text & Heading

`Text` draws text from the theme's type scale and colors, so it follows dark mode and your theme. `Heading` is a title with a level, for screen readers and the web's `<h1>`–`<h4>`.

```tsx
import { Heading, Text } from 'patine-ui';
```

```tsx live
import { Heading, Text, VStack } from 'patine-ui';

export default function Example() {
  return (
    <VStack gap="xs">
      <Heading level={2}>Order summary</Heading>
      <Text color="textSecondary">Three items, delivered on Friday.</Text>
    </VStack>
  );
}
```

## Example: an article header

A magazine's article header uses each step of the type scale for one job: a small bold kicker, the headline as a level-1 heading, a large secondary standfirst, and a small byline.

```tsx live
import { Avatar, HStack, Heading, Text, VStack } from 'patine-ui';

export default function Example() {
  return (
    <VStack gap="md" style={{ width: '100%', maxWidth: 600 }}>
      <Text size="xs" weight="semibold" color="primary">CITIES · LONG READ</Text>
      <Heading level={1}>The town that gave its streets back to bikes</Heading>
      <Text size="lg" color="textSecondary">
        Ten years after Pontevedra banned cars from its centre, the shops are full, the air is clean and nobody wants to go back.
      </Text>
      <HStack gap="sm">
        <Avatar size="sm" name="Inés Moreau" src="https://picsum.photos/id/65/120/120" />
        <VStack>
          <Text size="sm" weight="medium">Inés Moreau</Text>
          <Text size="xs" color="textSecondary">Nov 16, 2026 · 9 min read</Text>
        </VStack>
      </HStack>
    </VStack>
  );
}
```

## Headings

`level` sets the size and the heading level. Override the size with `size` while keeping the level.

```tsx live
import { Heading, VStack } from 'patine-ui';

export default function Example() {
  return (
    <VStack gap="sm">
      <Heading level={1}>Heading 1</Heading>
      <Heading level={2}>Heading 2</Heading>
      <Heading level={3}>Heading 3</Heading>
      <Heading level={4}>Heading 4</Heading>
    </VStack>
  );
}
```

## Accessibility

`Heading` has the `heading` role and its level, so screen reader users can jump between sections, on a phone and on the web. Text scales with the OS font size setting.

## Props

### Text

Text also takes React Native's `Text` props.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl' \| '3xl' \| 'display' \| 'hero'` | `'md'` | A step of the theme's type scale. `display` is a KPI or balance, `hero` the one number a screen is about. |
| `weight` | `'regular' \| 'medium' \| 'semibold' \| 'bold'` | `'regular'` | The theme's weights. `bold` is for display sizes; titles use `semibold`. |
| `font` | `'body' \| 'heading' \| 'display' \| 'numeric' \| 'mono'` | `'body'` | The theme's font role. `numeric` also lines digits up (tabular figures). |
| `color` | `keyof Theme['colors']` | `'text'` | One of the theme's colors, such as `textSecondary` or `primary`. |
| `theme` | `DeepPartial<Theme>` | — | Theme override. |

### Heading

Heading takes Text's props, with `weight` defaulting to `'semibold'` and `font` to `'heading'`, plus:

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `level` | `1 \| 2 \| 3 \| 4` | `2` | The heading level, and the size it gives. |
| `size` | `TextSize` | from `level` | Overrides the size. |
