Skip to main content

Chat

Markdown

An agent's reply, written in Markdown, drawn with Ouro's own parts: headings, paragraphs, lists, quotes, tables and rules, with bold, italic, strikethrough, inline code and links; fenced code is a CodeBlock with Copy. It builds React elements and never HTML: raw HTML in the reply shows as text, a link opens only to an http:, https: or mailto: address, and an image stays its words as a link to it, so the reply never makes the page fetch or run anything. While it streams in, an emphasis or code mark with no closing mark yet stays text and an open fence is code so far, so the reply never flips between plain and formatted. It takes the size of the text around it.

Three dinners for Thursday

All three take under 40 minutes, and two share the oven at 200°C.

  1. Roast squash with feta

  2. Leek tart, from the recipe you saved (opens in a new tab)

  3. A quick dal

Dinner, Time
DinnerTime
Roast squash35 min
Leek tart40 min
Dal30 min
sh
recipes scale dal --serves 6

Install

Hand it to your agent
Add Markdown from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/markdown.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823

Then the component (Installing):

npx shadcn@latest add ourostack/ouro-ui/markdown#v1.3.823
import { Markdown } from "@/components/ouro/markdown/markdown";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<Markdown streaming={!done}>{reply}</Markdown>

Use instead when

  • Use Text instead for the app's own words, and CodeBlock alone for code that isn't part of a reply.

Props

Type: MarkdownProps.

children (required)
Type: string
The agent's reply, as Markdown text.
className
Type: string
Layout only: margins, width (mt-2). Appearance classes warn in development.
headingLevel
Type: 2 | 3 | 4 | 5 | 6
Default: 3
The heading level of a # in the reply, one below the section's heading; ## is one more.
links
Type: boolean
Default: true
Whether a link opens. With false every link shows as its words alone, for apps whose agent text must stay data.
ref
Type: Ref<HTMLDivElement>
Reaches the rendered element.
streaming
Type: boolean
Whether the reply is still coming in. It marks the reply busy, and code whose closing fence hasn't arrived yet has no Copy until it does.

Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

  • allowHtml: Not a prop. Markdown never renders HTML; raw HTML in the reply shows as text.
  • content: Not a prop. The Markdown is the children: <Markdown>{reply}</Markdown>.
  • dangerouslySetInnerHTML: Not a prop. Markdown never renders HTML; raw HTML in the reply shows as text.
  • source: Not a prop. The Markdown is the children: <Markdown>{reply}</Markdown>.
  • text: Not a prop. The Markdown is the children: <Markdown>{reply}</Markdown>.

className is for layout only

Pass margins, width and grid placement (mt-4, w-full, col-span-2).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (hover:, sm:) and any ! are removed, it starts with bg-, text-, border-, rounded-, shadow-, font-, ring-, from-, via-, to-, fill- or stroke-, or is border, rounded, shadow or ring, or has a dark: variant. Text wrapping, overflow and table layout classes (text-wrap, text-ellipsis, border-collapse) are layout and do not warn.

Alignment classes (text-center) warn too: set alignment on a parent element.