Skip to content

Text and Title

React Title and Text for the text roles and title sizes.

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";

Usage

<h2 class="cap-title" data-size="2">Abstracts</h2>
<p class="cap-text" data-size="small" data-tone="muted">Submitted by the author.</p>
import { Text, Title } from "capsomer/react/text";

<Title as="h1" size={2}>Abstracts</Title>
<Text size="small" tone="muted">Submitted by the author.</Text>

API reference

Title

PropTypeRequiredDoes
size1 | 2 | 3 | 4 | 5 | 6The look, 1 the largest to 6; 4 when omitted. The heading level is as (h2 when omitted).
classNamestring
asT

Text

PropTypeRequiredDoes
size"tiny" | "small" | "lead"
tone"muted" | "dim" | "ink" | "accent" | "ok" | "crit"
weight"strong"
face"ui" | "mono" | "prose" | "display"
align"center" | "end"
classNamestring
asT

Accessibility

  • Title renders an h2 by default and size changes only the look, so set as to the level the outline needs: an h1 that looks like a 2 is <Title as="h1" size={2}>.
  • Every tone keeps its contrast on every surface (contrast report).