Text
A body-text primitive: paragraph or inline span across four sizes, four weights, three leadings, and four tones.
Live demo
Text is the primitive for running copy. It renders a block <p> by default or an inline <span> via the as prop, then tunes appearance along four independent axes: size (xs, sm, body, lg), weight (normal, medium, semibold, bold), leading (tight, snug, loose), and tone (default ink, muted, subtle, or accent).
A mono flag swaps the family to the monospace stack for inline code and tabular figures. Every axis maps to a design token, so a paragraph picks up the active theme's type scale and ink ladder without any local color: default reads as --fg-0, muted steps down to --fg-2, subtle to --fg-3, and accent tints to --accent-text.
When to use
How this component composes with the rest of the set.
Props
6 props, straight from the manifest.
| Prop | Type | Default | Bindings | Description |
|---|---|---|---|---|
Appearance
Variants
default
Primary ink at full strength; the standard reading tone.
muted
A step down the ink ladder for secondary copy and asides.
subtle
The quietest ink: captions, fine print, and metadata.
accent
Accent-tinted ink for a highlighted word, link-like emphasis, or a figure.
mono
Monospace family for inline code and tabular figures; composes with any tone or size.
Sizes
xs
Smallest: fine print.
sm
Small: secondary copy.
body
Default reading size.
lg
Large: lead paragraphs.
Anatomy
The named parts that make up the component, with their selectors.
text
The paragraph or span element carrying the size, weight, leading, tone, and mono classes.
Tokens & coverage
What the component consumes, checked live against what the algorithm produces.
Live coverage check against the xoji-default register
(derive(xojiDefault, { anchors }) →
coverComponent(manifest, register)). Every token this component
consumes must be a key the algorithm produces.
--accent-text
--fg-0
--fg-2
--fg-3
--font-mono
--font-sans
--leading-loose
--leading-normal
--leading-tight
--text-body
--text-lg
--text-sm
--text-xs
--weight-bold
--weight-medium
--weight-normal
--weight-semibold
Slots
The text content.
Accessibility
Code
Sizes, tones, and mono
The four axes are independent: size, weight, leading, and tone mix freely, and mono layers on top.
<xoji-text>The quiet default — body copy at comfortable measure.</xoji-text>
<xoji-text size="lg" weight="semibold">A lead paragraph that sets up the section.</xoji-text>
<xoji-text tone="muted" size="sm">A muted aside, dialed down a notch.</xoji-text>
<xoji-text as="span" tone="subtle" size="xs">inline fine print</xoji-text>
<xoji-text mono size="sm">npm install @xoji/core</xoji-text>
<script lang="ts">
import { Text } from "@xoji/svelte";
</script>
<Text>The quiet default — body copy at comfortable measure.</Text>
<Text size="lg" weight="semibold">A lead paragraph that sets up the section.</Text>
<Text tone="muted" size="sm">A muted aside, dialed down a notch.</Text>
<Text as="span" tone="subtle" size="xs">inline fine print</Text>
<Text mono size="sm">npm install @xoji/core</Text>
---
import { Text } from "@xoji/astro";
---
<Text>The quiet default — body copy at comfortable measure.</Text>
<Text size="lg" weight="semibold">A lead paragraph that sets up the section.</Text>
<Text tone="muted" size="sm">A muted aside, dialed down a notch.</Text>
<Text as="span" tone="subtle" size="xs">inline fine print</Text>
<Text mono size="sm">npm install @xoji/core</Text>