Skip to content
Page

Text

Typography primitive that maps a semantic text token to an element.

Heading small

Title mediumSubtitle mediumBody medium is the default reading size.Caption medium
import { Text } from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/TextExample.tsx
import { Stack, Text } from "@pelagornis/page/components";
export default function TextDemo() {
return (
<Stack gap="sizeSmall" className="w-full">
<Text as="h3" variant="headingSm">
Heading small
</Text>
<Text variant="titleMd">Title medium</Text>
<Text variant="subtitleMd">Subtitle medium</Text>
<Text variant="bodyMd">Body medium is the default reading size.</Text>
<Text variant="captionMd">Caption medium</Text>
</Stack>
);
}

Text can be written straight in an .mdx page. Import it below the frontmatter. It renders on the server, so no client directive is needed.

src/content/docs/example.mdx
---
title: Example
---
import { Text } from "@pelagornis/page/components";
<Text as="p" variant="titleMd">Title medium</Text>
<Text variant="captionMd">Caption</Text>

pageMarkdoc() registers a text tag for this component. Add the preset once in markdoc.config.mjs (see Use in Markdoc), then write the tag in any .mdoc page.

src/content/docs/example.mdoc
{% text as="p" variant="titleMd" %}Title medium{% /text %}

Attributes use the same names and values as the React props.

Parts of the component and the data-refineui role each one renders.

PartRole
roottext