Reference

Components

Each component takes an intent and decides the element from it.

From intent to element

heading.page

the intent you choose

<Text>

the component its domain needs

<h1>

the element it renders

The domain decides the component. Using an intent on the wrong component fails tsc.

The components

Text

Headings, running text and feedback messages.

Action

Everything the user presses: commands, links, navigation and choices.

Field

What the user types or picks in a form.

Layout

Page regions and groups.

Media

Images that identify a person or illustrate content, and frames that show another page (media.embed).

Dialog

Modal interruptions on the native <dialog>: focus stays inside, Escape closes it and the page behind is inert.

Popover

Things that open next to the button that opened them, without blocking the page: menus, pickers, extra detail.

What they share

Rules that hold for all seven. Each component page repeats only what is different.

  • Styling

    No className or style (Layout takes a className for layout only). If it needs to look different, it is a different intent.

  • State

    pressed and current props, or data-* attributes the intent styles. Never a switched class.

  • Data-driven values

    Through vars, as CSS variables the intent reads.

  • Layout props

    align, width, hideBelow, showBelow, truncate, nowrap: where it sits, never how it looks. Layout takes align, hideBelow and showBelow.

  • data-intent

    Every element carries its intent, for analytics and tests. Never for styling.

They are your code

Terminal
npx prongs add   # copies them into components/prongs

Copied in, not installed. These pages describe the components as they arrive; if you change one, its props here may no longer match yours.