# Rich Text

> The Markdown subset agents write, rendered in the kit's type: what ChatMessage uses for answers, on its own for notes, briefings and logs.

Component · AI · Pro kit · [Live page](https://ui.twentyfirst.media/pro/components/RichText/)

The Markdown subset agents write, rendered in the kit's type: what `ChatMessage` uses for answers, on its own for notes, briefings and logs.

- Paragraphs (single line breaks stay), headings (`#` to `######`), **bold**, *italic*, ~~strike~~, `inline code`, links and bare URLs.
- Lists, nested by indenting, numbered lists keep their start, task lists (`- [x]`, `- [ ]`) with a checked or open box.
- Quotes (`>`), rules (`---`), tables with alignment (`:--`, `--:`, `:-:`) that scroll sideways on their own when they are wider than the screen.
- Fenced code blocks with the language and a copy button.
- Links are safe: only http(s), mailto, tel and relative links become links (`safeHref`); `javascript:`, `data:` and the like stay text. External links open in a new tab; relative ones use `linkAs` (your router).
- Long words and URLs wrap instead of widening the page.
- `highlight` marks the words of a search; `streaming` shows the caret and keeps an unfinished code block open.

## Example

```tsx
import { RichText } from "@twentyfirstmedia/pro";

const MD = `## Renewal for Northwind

Northwind renews on **May 1**. The new list price applies from then; *existing seats keep their price* until the term ends. ~~Old discount~~ no longer applies.

| Plan | Seats | Per seat | Per month |
|:--|--:|--:|--:|
| Team | 40 | €24 | €960 |
| Team, prorated April | 40 | €12 | €480 |

1. Check the seat count with Ida
   - she asked for **40**, the contract says 35
   - the extra 5 are trial users
2. Send the quote
3. Book the call for the renewal

- [x] Prices checked
- [ ] Quote sent
- [ ] Call booked

> The quote must say that the prorated amount is billed with the next invoice.

Notes: https://example.com/handbook/sales/renewals-and-prorated-seats-for-annual-plans and \`billing.prorate(seats, from)\`.

\`\`\`ts
const total = seats * price * (daysLeft / daysInMonth);
\`\`\``;

export default function Preview() {
  return (
    <div className="tf-panel">
      <RichText text={MD} />
    </div>
  );
}
```

## Props

### RichText

| Prop | Type | Notes |
| --- | --- | --- |
| `text` | `string` | Markdown: paragraphs, headings, **bold**, *italic*, ~~strike~~, `code`, links, bare URLs, nested and task lists, quotes, tables, rules and fenced code blocks with copy. |
| `streaming?` | `boolean` |  |
| `className?` | `string` |  |
| `highlight?` | `string` | Marks the words of a search. |
| `linkAs?` | `ElementType` | Router link for relative links. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### CodeBlock

| Prop | Type | Notes |
| --- | --- | --- |
| `code` | `string` | Required |
| `lang?` | `string` |  |
| `open?` | `boolean` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
