Skip to content

Typography

Semantic text hierarchy for TUIs. Since terminals can't vary font size, these presets use color + bold/dim/italic to create clear visual levels.

All components accept an optional color prop to override the default color.

tsx
import {
  H1,
  H2,
  H3,
  P,
  Lead,
  Muted,
  Small,
  Strong,
  Em,
  Code,
  Kbd,
  Blockquote,
  CodeBlock,
  HR,
  UL,
  OL,
  LI,
} from "silvery"

Headings

ComponentDefault StyleUse For
<H1>$primary + boldPage title, maximum emphasis
<H2>$accent + boldSection heading, contrasts with H1
<H3>bold (no color)Group heading, stands out without accent
tsx
<H1>Settings</H1>                    // $primary + bold
<H2>General</H2>                      // $accent + bold
<H3>Appearance</H3>                   // bold
<H1 color="$success">Panel A</H1>    // override color for differentiation

Body Text

ComponentDefault StyleUse For
<P>plain textBody text (semantic wrapper)
<Lead>$muted + italicIntroductory/lead text
<Muted>$mutedSecondary/supporting text
<Small>$muted + dimFine print, captions, footnotes
tsx
<P>Use dark colors for the UI.</P>    // plain body text
<Lead>Welcome to the app</Lead>       // $muted + italic
<Muted>Requires restart</Muted>       // $muted
<Small>Last updated 2 hours ago</Small> // $muted + dim

Inline Emphasis

ComponentDefault StyleUse For
<Strong>boldInline strong emphasis
<Em>italicInline emphasis
tsx
<Text>
  This is <Strong>important</Strong> and <Em>emphasized</Em>.
</Text>

Code & Keys

ComponentDefault StyleUse For
<Code>$mutedbg backgroundInline code
<Kbd>$mutedbg + boldKeyboard shortcut badge
<CodeBlock>$border left borderMulti-line code block
tsx
<Code>npm install silvery</Code>      // inline code
<Kbd>Ctrl+C</Kbd>                      // keyboard shortcut
<CodeBlock>{"const x = 1\nconst y = 2"}</CodeBlock>

Block Elements

ComponentDefault StyleUse For
<Blockquote>$muted border + italicQuotations
<HR>$border dashesHorizontal rule
tsx
<Blockquote>Less is more.</Blockquote>
<HR />

Lists

Lists support nesting via UL/OL containers.

ComponentStyleUse For
<UL>containerUnordered list
<OL>container (auto-numbers)Ordered list
<LI>bullet/number + indentedList item
tsx
<UL>
  <LI>First item</LI>
  <LI>Second item
    <UL>
      <LI>Nested bullet</LI>
    </UL>
  </LI>
</UL>

<OL>
  <LI>Step one</LI>
  <LI>Step two</LI>
</OL>

Bullet styles vary by nesting depth: -.

Props

TypographyProps

All typography components share this interface:

typescript
interface TypographyProps {
  children?: ReactNode
  color?: string // Override the default color
}

The color prop overrides the default semantic color, useful for panel differentiation:

tsx
<H1 color="$success">Success Panel</H1>
<H1 color="$warning">Warning Panel</H1>

Migration Guide

Replace manual typography patterns with presets:

BeforeAfter
<Text bold color="$primary">Title</Text><H1>Title</H1>
<Text bold color="$accent">Section</Text><H2>Section</H2>
<Text bold>Heading</Text><H3>Heading</H3>
<Text color="$muted">Info</Text><Muted>Info</Muted>
<Text dimColor>Fine print</Text><Small>Fine print</Small>
<Text dimColor color="$muted">Caption</Text><Small>Caption</Small>
<Text bold color={c}>Label</Text><Strong color={c}>Label</Strong>
<Text italic>Note</Text><Em>Note</Em>
<Text backgroundColor="$mutedbg"> code </Text><Code>code</Code>

Released under the MIT License.