Heading
Semantic heading with decoupled level and visual size so document outline and typography scale independently.
Renders <h1>–<h6> based on the level prop; size is purely visual so structural hierarchy stays correct even when designs diverge from the heading scale.
import { Heading } from '@arshad-shah/cynosure-react';
export default function Example() {
return <Heading level={1}>Welcome to Cynosure</Heading>;
}
Levels
Section titled “Levels”Use level to set the rendered tag (1–6). When size is omitted the visual scale defaults to the matching heading composite token, so a level={2} heading looks like an h2 out of the box.
import { Heading } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
<Heading level={1}>Heading level 1</Heading>
<Heading level={2}>Heading level 2</Heading>
<Heading level={3}>Heading level 3</Heading>
<Heading level={4}>Heading level 4</Heading>
<Heading level={5}>Heading level 5</Heading>
<Heading level={6}>Heading level 6</Heading>
</div>
);
}
Nine sizes are exposed — xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl. Pair a small size with a high level to keep semantics intact while shrinking the type scale, or vice versa.
import { Heading } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
<Heading level={2} size="5xl">
Size 5xl
</Heading>
<Heading level={2} size="4xl">
Size 4xl
</Heading>
<Heading level={2} size="3xl">
Size 3xl
</Heading>
<Heading level={2} size="2xl">
Size 2xl
</Heading>
<Heading level={2} size="xl">
Size xl
</Heading>
<Heading level={2} size="lg">
Size lg
</Heading>
<Heading level={2} size="md">
Size md
</Heading>
<Heading level={2} size="sm">
Size sm
</Heading>
<Heading level={2} size="xs">
Size xs
</Heading>
</div>
);
}
Weights
Section titled “Weights”Override the default weight from the heading token with regular, medium, semibold, or bold.
import { Heading } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.25rem' }}>
<Heading level={3} weight="regular">
Regular weight
</Heading>
<Heading level={3} weight="medium">
Medium weight
</Heading>
<Heading level={3} weight="semibold">
Semibold weight
</Heading>
<Heading level={3} weight="bold">
Bold weight
</Heading>
</div>
);
}
Truncate
Section titled “Truncate”Pass truncate for ellipsis on one line or a number for multi-line clamp — handy for card titles inside fixed layouts.
import { Heading } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.75rem', maxWidth: '20rem' }}>
<Heading level={3} truncate>
A long card title that elides when the row runs out of room
</Heading>
<Heading level={3} size="lg" truncate={2}>
Two-line clamp keeps the title scannable while still showing enough of the longer phrasing
to make sense
</Heading>
</div>
);
}
Accessibility
Section titled “Accessibility”levelalways controls the rendered element so the document outline stays correct for screen readers and SEO.- Decouple
sizefromlevelto keep visual hierarchy flexible without skipping headings (don’t jump from h1 to h4 just to shrink type). - One
h1per page; reach forlevel={2}or deeper inside sections. truncatehides overflow visually only — keep the full heading in the DOM so assistive tech receives it.- Maintain enough contrast between heading colour and background; large weights still need to pass WCAG large-text minimums.
Recipes
Section titled “Recipes”- Pair
HeadingwithText variant="lead"directly underneath for a familiar title + lede pattern. - Use
align="center"for hero headings andalign="start"(default) for body sections. - Combine a small
Text variant="overline"above aHeadingfor a section eyebrow without losing semantics. - Use
asChildto project Heading typography onto a link wrapper for clickable card titles.