Text
Typography primitive that maps a semantic text token to an element.
Heading small
Title mediumSubtitle mediumBody medium is the default reading size.Caption mediumImport
Section titled “Import”import { Text } from "@pelagornis/page/components";Example
Section titled “Example”The preview above renders this file. Copy it into src/components/ to start from it.
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> );}Use in MDX
Section titled “Use in MDX”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.
---title: Example---
import { Text } from "@pelagornis/page/components";
<Text as="p" variant="titleMd">Title medium</Text><Text variant="captionMd">Caption</Text>Use in Markdoc
Section titled “Use in Markdoc”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.
{% text as="p" variant="titleMd" %}Title medium{% /text %}Attributes use the same names and values as the React props.
Anatomy
Section titled “Anatomy”Parts of the component and the data-refineui role each one renders.
| Part | Role |
|---|---|
root | text |
Reference
Section titled “Reference”- Use in MDX and Use in Markdoc for the general rules.