Composition & Layout
Typography
Typography centralizes modern text styles with semantic variants. Build a clear hierarchy with reusable structure, consistent spacing and semantic surfaces. Keep layout decisions close to the content they organize. Import it from @/components/kamod-ui/typography.
Source · API reference · Theming · Styles
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthInstallation
Import Typography from @/components/kamod-ui/typography.
pnpm add @kamod-ch/uiCopy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.
Usage
Use semantic elements via as and apply the matching visual variant for consistent hierarchy.
import { Typography } from "@kamod-ch/ui";Choose a complete composition from the examples below; required child components and props vary by pattern.
Component Examples & Variants
Explore Typography in Different Contexts, from the starting pattern to the compositions below. Begin with Full Typography Example, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.
Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.
Full Typography Example
Review the Page Rhythm as a Whole. Read a complete article-style composition to see headings, body text, quotations, lists and a table work together. Typography coordinates their presentation, while the document's semantic hierarchy continues to describe how the ideas relate.
Keep semantic elements meaningful rather than choosing them only for their appearance, and inspect the composition at narrow widths with realistic text lengths.
import { Typography } from "@kamod-ch/ui";
export const Example = () => (
<div class="max-w-3xl space-y-4">
<Typography as="h1" variant="h1">Taxing Laughter: The Joke Tax Chronicles</Typography>
<Typography as="p" variant="p">
Once upon a time, in a far-off land, there was a very lazy king who spent all day lounging on his throne.
One day, his advisors came to him with a problem: the kingdom was running out of money.
</Typography>
<Typography as="h2" variant="h2">The King's Plan</Typography>
<Typography as="p" variant="p">
The king thought long and hard, and finally came up with a brilliant plan: he would tax the jokes in the kingdom.
</Typography>
<Typography as="blockquote" variant="blockquote">
"After all," he said, "everyone enjoys a good joke, so it's only fair that they should pay for the privilege."
</Typography>
<Typography as="h3" variant="h3">The Joke Tax</Typography>
<Typography as="ul" variant="list">
<li>1st level of puns: 5 gold coins</li>
<li>2nd level of jokes: 10 gold coins</li>
<li>3rd level of one-liners : 20 gold coins</li>
</Typography>
</div>
);h1
Use the Top Heading to Name the Page. Use the h1 treatment for the page's main title, giving the document a clear starting point. Choose the semantic heading level according to its role rather than selecting the largest font merely for emphasis.
Keep its visual prominence distinct from supporting copy and avoid choosing an h1 merely to enlarge text inside a smaller component or card.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthh2
Introduce a Major Section in the Document. Use the h2 treatment to introduce a major section beneath the page title. Its divider creates a quiet structural break, separating substantial topics while maintaining the shared typography of the article.
Keep the level consistent with the page outline and check that anchor navigation leaves enough room above the heading for it to remain visible.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthh3
Organize Content within a Larger Section. Use the h3 treatment for a subsection within a larger topic. Keep its wording specific to that part of the explanation so the heading remains meaningful when read in the page's outline or contents navigation.
Keep labels concise but specific, and preserve the hierarchy instead of skipping levels to obtain a preferred size; visual styling and semantic structure serve different purposes.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthh4
Use a Local Heading Only When the Structure Needs It. Use h4 for a further level of detail when a subsection genuinely needs smaller topics. This preserves the relationship to its parent heading instead of creating another unrelated main section solely for a smaller font size.
Keep the relationship to its parent clear and use ordinary emphasized text for small labels that are not actual sections.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthParagraph
Keep Ordinary Reading Comfortable. Use the paragraph treatment for the explanation that connects headings, examples and decisions. Keep each paragraph focused on one idea, using inline emphasis or code where it helps the reader distinguish terminology from ordinary prose.
Break long explanations into coherent paragraphs, use emphasis selectively and let links and inline code stand out without turning the whole paragraph into competing visual fragments.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthBlockquote
Mark a Quotation as a Quotation. Use blockquote for an actual quotation or clearly attributed excerpt that belongs apart from the main explanation. Its visual boundary helps identify the quoted voice, while the surrounding text should explain why the passage matters.
Keep the source or speaker clear where relevant and preserve surrounding context; use Alert when the content is an instruction or status message from the application itself.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthTable
Keep Structured Comparisons Semantic. Use the table typography inside a suitable responsive wrapper when information needs row-and-column comparison. Keep headers descriptive and cells concise so the structure remains meaningful when the available reading width changes.
Use tables for actual row-and-column relationships, not general page layout, and keep long cell content readable without forcing the entire document wider than the viewport.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthList
Use a List When the Items Are Genuinely Parallel. Use the list treatment for related items that benefit from parallel wording and clear separation. The shared indentation and spacing should make the sequence easy to scan without replacing paragraphs that need connected explanation.
Keep each item's phrasing consistent, avoid excessive nesting and use real list markup so the structure remains available beyond its visual indentation.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthInline Code
Distinguish Literal Values from Explanatory Prose. Use inline code for exact package names, tokens or identifiers that readers may need to recognize or copy. Keep the spelling and casing of values such as class intact even when surrounding emphasized prose uses title case.
Keep punctuation outside the code when it is not part of the value, and move longer examples into a separate code block rather than stretching a paragraph.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthLead
Introduce the Section without Repeating Its Heading. Use the lead treatment for a short introduction that establishes the purpose of a section before the detailed explanation. Its larger, secondary typography should summarize the reader's next task without duplicating the full paragraph below it.
Keep it brief enough to remain an introduction and reserve its larger treatment for a small number of meaningful entry points on the page.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthLarge
Emphasize a Short Piece of Supporting Content. Use the large treatment for a short piece of emphasized text within the existing document structure. It can highlight a local takeaway, but a true section title should still use an appropriate semantic heading.
Keep the semantic element appropriate to the content, and avoid using enlarged text for long paragraphs that compete with the page's actual hierarchy.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthSmall
Keep Helper Text Readable and Useful. Use the small treatment for brief supporting labels near the content they explain. Keep it readable at the intended viewport size, especially when the label carries information needed to understand a nearby control.
Do not hide required information through tiny type; essential field guidance belongs close to the control it explains.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthMuted
Make Secondary Context Quieter without Making It Disappear. Use muted typography for secondary context that supports the main message without competing with it. The text should remain legible in both themes, and essential instructions should not depend on unusually faint presentation.
Check both themes and preserve sufficient readability, especially when small type or long paragraphs would amplify the reduced emphasis.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthProps and Data
Configure Typography using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.
Props, slots and variants for this component.
Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.
Component Props
? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.Typography
TypographyProps
| Prop / type | Description |
|---|---|
as | Configure
|
children | Configure
|
class | Configure
|
variant | Configure
|
Data Type Reference
Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.
TypographyVariants
DeclarationTypographyVariantsTypography.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TypographyVariants before adapting it.Typography Props
2 declared fieldsTypographyPropsTypography.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TypographyProps before adapting it.Accessibility
Typography styling affects how content looks; accessibility depends on the actual elements and reading structure used by each primitive. Visual size should not be used as a substitute for a coherent heading hierarchy.
You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.
Connect the Foundation
Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.
Build the Surrounding Screen
Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.
Make the Result Hold Up
Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.
Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.