> ## Documentation Index
> Fetch the complete documentation index at: https://react-docx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Text

Applies styling to text. Usually you don't need it (plain strings work fine).

```tsx theme={"dark"}
// Plain string - no Text needed
<Paragraph>Hello world</Paragraph>

// With styling - use Text
<Paragraph>
  Hello <Text className="font-bold text-blue-600">world</Text>
</Paragraph>
```

***

## When to use Text

**Don't need it:**

```tsx theme={"dark"}
<Paragraph>Just plain text</Paragraph>
<H1>Plain heading</H1>
```

**Need it:**

```tsx theme={"dark"}
<Paragraph>
  Mix of <Text className="font-bold">bold</Text> and normal
</Paragraph>
```

Rule: only wrap in `<Text>` when you need to apply classes.

***

## Props

| Prop        | Type        | Description      |
| ----------- | ----------- | ---------------- |
| `children`  | `ReactNode` | Text content     |
| `className` | `string`    | Tailwind classes |

***

## Styling

### Font weight

```tsx theme={"dark"}
<Text className="font-bold">Bold</Text>
<Text className="font-extrabold">Extra bold</Text>
```

### Font style

```tsx theme={"dark"}
<Text className="italic">Italic</Text>
<Text className="underline">Underlined</Text>
<Text className="line-through">Strikethrough</Text>
```

### Colors

```tsx theme={"dark"}
<Text className="text-red-500">Red text</Text>
<Text className="text-blue-700">Dark blue</Text>
<Text className="bg-yellow-200">Highlighted</Text>
```

### Sizes

```tsx theme={"dark"}
<Text className="text-xs">Extra small</Text>
<Text className="text-sm">Small</Text>
<Text className="text-base">Base</Text>
<Text className="text-lg">Large</Text>
<Text className="text-2xl">2XL</Text>
```

### Font family

```tsx theme={"dark"}
<Text className="font-serif">Serif font</Text>
<Text className="font-mono">Monospace</Text>
```

### Caps

```tsx theme={"dark"}
<Text className="uppercase">ALL CAPS</Text>
<Text className="capitalize">Small Caps</Text>
```

### Super/subscript

```tsx theme={"dark"}
<Paragraph>
  H<Text className="align-sub text-xs">2</Text>O
</Paragraph>

<Paragraph>
  E = mc<Text className="align-super text-xs">2</Text>
</Paragraph>
```

***

## Formatting shortcuts

Instead of `<Text className="font-bold">`, use shortcuts:

```tsx theme={"dark"}
<Bold>Bold text</Bold>
<Italic>Italic text</Italic>
<Underline>Underlined text</Underline>
<Strike>Strikethrough</Strike>
```

Combine them:

```tsx theme={"dark"}
<Bold>
  <Italic>Bold and italic</Italic>
</Bold>

<Bold className="text-red-500">Bold and red</Bold>
```

***

## Combining styles

```tsx theme={"dark"}
<Paragraph>
  <Text className="text-2xl font-bold text-blue-700">Big bold blue</Text>
  <Text className="text-sm text-gray-500"> (with small gray note)</Text>
</Paragraph>
```

***

## Auto-generation

The React reconciler automatically wraps plain strings. This:

```tsx theme={"dark"}
<Paragraph>Hello world</Paragraph>
```

Internally becomes:

```tsx theme={"dark"}
<Paragraph>
  <Text>Hello world</Text>
</Paragraph>
```

You never see this (it just works). Write plain strings, add `<Text>` only when styling.

***

## Common patterns

### Label + value

```tsx theme={"dark"}
<Paragraph>
  <Text className="font-bold">Name: </Text>John Doe
</Paragraph>
```

### Colored keywords

```tsx theme={"dark"}
<Paragraph>
  Status: <Text className="text-green-600 font-bold">Active</Text>
</Paragraph>
```

### Fine print

```tsx theme={"dark"}
<Paragraph>
  Main content here.
  <Text className="text-xs text-gray-400"> *Terms apply</Text>
</Paragraph>
```

### Code inline

```tsx theme={"dark"}
<Paragraph>
  Run <Text className="font-mono bg-gray-100">npm install</Text> to start.
</Paragraph>
```
