prongs
GitHub

Text

Headings, running text and feedback messages. The intent decides the element (<h1>, <p>, <span>, <pre>) and the look.

Renders

h1h2h3

Intents

Examples

A page title

A kicker names the section, the page heading is the one <h1>, and the lead introduces the page.

Preview

Settings

Notifications

Choose what we email you about, and how often.

<Layout intent="layout.group">
<Text intent="heading.kicker">Settings</Text>
<Text intent="heading.page">Notifications</Text>
<Text intent="text.lead">Choose what we email you about, and how often.</Text>
</Layout>

An item and its facts

Facts about one thing go in text.meta, side by side in an arrange.row.

Preview

Quarterly report

PDF2.4 MBUpdated 3 days ago

Revenue grew in every region, led by new customers in the north.

<Layout intent="layout.group">
<Text intent="heading.item">Quarterly report</Text>
<Layout intent="layout.group" className="flex-row flex-wrap">
<Text intent="text.meta">PDF</Text>
<Text intent="text.meta">2.4 MB</Text>
<Text intent="text.meta">Updated 3 days ago</Text>
</Layout>
<Text intent="text.excerpt">Revenue grew in every region, led by new customers in the north.</Text>
</Layout>

Messages

feedback.* intents are announced to screen readers: errors at once, the rest politely.

Preview

Your changes were saved.

<Layout intent="layout.group">
<Text intent="feedback.success">Your changes were saved.</Text>
<Text intent="feedback.error">That address is already taken.</Text>
</Layout>

Figures

A headline number is text.stat; the words that name it are text.label.

Preview

12

Projects

4

Members

2.1 GB

Storage
<Layout intent="layout.collection" className="grid-cols-3">
<Layout intent="layout.group">
<Text intent="text.stat">12</Text>
<Text intent="text.label">Projects</Text>
</Layout>
<Layout intent="layout.group">
<Text intent="text.stat">4</Text>
<Text intent="text.label">Members</Text>
</Layout>
<Layout intent="layout.group">
<Text intent="text.stat">2.1 GB</Text>
<Text intent="text.label">Storage</Text>
</Layout>
</Layout>

Intents it renders

3 domains, each with its own page of neighbours and examples. The intent decides the element; these are the starter intents.

Heading heading.*

6 intents
  • heading.page

    The one title of a page: Settings, Sign in, Privacy policy, a profile name, a marketing headline

    <h1>
  • heading.section

    Title of a major part of a page

    <h2>
  • heading.item

    Title of a single thing: a list item, a panel, a dialog

    <h3>
  • heading.group

    Names a group of items in a list, menu or sidebar: Today, Account, Integrations

    <h3>
  • heading.kicker

    A short label above a heading that names its category or series

    <p>
  • heading.pitch

    The persuasive headline of a marketing page: what the product does for you

    <h1>

Text text.*

15 intents
  • text.body

    Running text: sentences and paragraphs that explain something

    <p>
  • text.lead

    Introductory paragraph directly under the title of a page, section or dialog

    <p>
  • text.caption

    A supporting sentence next to something else: helper text under a field, a note under an image

    <p>
  • text.label

    A few words that name a value: field labels, setting names, column headers. Use as="label" htmlFor=... for form fields

    <span>
  • text.meta

    Small facts about an item or the page: timestamps, authors, @handles, file sizes, "1–50 of 312", a copyright line

    <span>
  • text.status

    The state something is in, as a word: Flying, Charging, On time, Overdue. data-tone="success", "info", "warning", "danger" or "muted" colours it

    <span>
  • text.count

    A number that sums something up: unread notifications, items waiting

    <span>
  • text.indicator

    Marks something as new or unread, or shows a status, with no word or number. Give it an aria-label, like "Unread" or "Charging"; data-tone="success", "info", "warning", "danger" or "muted" colours a status; data-busy shows it is in progress

    <span>
  • text.summary

    The line that stays visible in a layout.disclosure; pressing it opens or closes the content

    <summary>
  • text.stat

    A number that stands out on its own: a metric, a result, a price, an order total

    <p>
  • text.code

    A block of code or terminal output shown to the reader

    <pre>
  • text.quote

    Words quoted from someone, set apart from the text around them: a pull quote in an article, a testimonial. Renders <blockquote>

    <blockquote>
  • text.topic

    Names a topic or category an item belongs to: News, Science

    <span>
  • text.excerpt

    A short extract of a longer text, shown as a preview: an article summary

    <p>
  • text.prose

    Rich content written elsewhere and shown here: rendered Markdown, a post body with headings, lists and links

    <div>

Feedback feedback.*

5 intents
  • feedback.error

    Something failed or input is invalid. Announced to screen readers immediately

    <p>
  • feedback.warning

    Something may go wrong unless the user acts

    <p>
  • feedback.success

    An action the user took worked

    <p>
  • feedback.info

    A neutral status about the current state: loading, searching, nothing to show yet

    <p>
  • feedback.busy

    Something is working, with no measure of how far: in a button while it sends, over a region while it updates. A spinning mark before its text, like "Saving…"; with no text, give it an aria-label

    <span>

Props

Plus its element’s usual attributes (id, onClick, aria-*, data-*) and the shared layout props below. No className or style.

  • intent required

    What this text is for: heading.*, text.* or feedback.*.

    TextIntent
  • as

    Changes the element for document structure only, like as="label" for a field label or as="h2" for a dialog title. The intent still decides the look.

    'h1'…'h6' | 'p' | 'span' | 'div' | 'label' | 'dt' | 'dd'
  • htmlFor

    With as="label": the id of the field it labels.

    string
  • vars

    Values that come from data, as CSS variables the intent reads: vars={{ '--accent': user.color }}.

    Record<`--${string}`, string | number>
  • unsafeClassName

    Bypasses the intent. Needs a // prongs-unsafe: <reason> comment on the line above, and prongs check counts it.

    string

Layout props

Where the element sits, never how it looks. Spacing between elements comes from the parent <Layout>.

  • align

    On text, the text alignment. On anything else, pushes it to that end of its row or column.

    'start' | 'center' | 'end'
  • width

    Full width, or a maximum width.

    'auto' | 'full' | 'prose' | 'sm' | 'md' | 'lg'
  • hideBelow

    Hidden on screens narrower than this breakpoint.

    'sm' | 'md' | 'lg'
  • showBelow

    Shown only on screens narrower than this breakpoint.

    'sm' | 'md' | 'lg'
  • truncate

    One line, cut off with an ellipsis.

    boolean
  • nowrap

    Keeps the text on one line.

    boolean

Rules

  • No className or style. If text needs to look different, it is a different intent.

  • Use as only to fix document structure, never to change the look.

  • Emphasis inside a sentence is plain <strong> or <em>, not another <Text>.