prongs
GitHub

Action

Everything the user presses: commands, links, navigation and choices. With href it renders a link, without one a <button>.

Renders

buttona

Intents

Examples

Commands

Named for what they do. The look follows from the meaning: deleting is destructive, cancelling is quiet.

Preview
<Layout intent="layout.actions">
<Action intent="action.cancel">Cancel</Action>
<Action intent="action.save">Save changes</Action>
<Action intent="action.delete">Delete</Action>
</Layout>

Links

With href the same component renders a link.

Preview

Read the guide to intents before you add one.

<Text intent="text.body">
Read the <Action intent="action.navigate" href="/docs/what-is-an-intent">guide to intents</Action> before you add one.
</Text>

On and off

pressed sets aria-pressed, and the intent styles the pressed state.

Preview
<Layout intent="layout.toolbar">
<Action intent="choice.filter" pressed>All</Action>
<Action intent="choice.filter" pressed={false}>Unread</Action>
<Action intent="choice.filter" pressed={false}>Starred</Action>
</Layout>

The page you are on

current sets aria-current on navigation.

Preview
<Layout intent="layout.group" className="flex-row gap-5">
<Action intent="nav.page" href="#current-page" current>Overview</Action>
<Action intent="nav.page" href="#current-page">Activity</Action>
<Action intent="nav.page" href="#current-page">Settings</Action>
</Layout>

An icon alone

Without visible text, label is required: it is the accessible name.

Preview
<Action intent="action.dismiss" icon={<X aria-hidden className="size-4" />} label="Dismiss" />

Intents it renders

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

Action action.*

15 intents
  • action.submit

    Does what a form, dialog or step exists for: send, save, create, confirm, next, pay, and the submit of a form that begins something, like Sign up. Pass verb="save", "create", "pay"... to name it for analytics.

    <button>
  • action.start

    The main action of a page or region that begins something: New project, Get started, Sign up, Start a trial. Pass verb="create", "signup"... to name it for analytics.

    <a>
  • action.cancel

    Backs out or says no without keeping anything: cancel, discard, decline an invitation, not now

    <button>
  • action.delete

    Permanently destroys data

    <button>
  • action.toggle

    Turns a state on or off and shows which: follow, subscribe, like. Pass pressed={on}

    <button>
  • action.command

    Does something and stays on the page: edit, add, remove, retry, share, open, back, refresh, duplicate, move, download, archive, sign out. The label says the verb; pass verb="duplicate", "archive"... to name it for analytics. Pass tone="danger" when it is destructive or hard to undo, like leaving a workspace.

    <button>
  • action.copy

    Copies a value to the clipboard: an ID, an API key, a link, a code snippet. Show that it copied

    <button>
  • action.dismiss

    Closes or hides something without changing data: a dialog, notice or menu

    <button>
  • action.reveal

    Opens a menu or shows content in place: the more-actions button on a row, show password, show more

    <button>
  • action.navigate

    Goes to another page or place, from inside a sentence or on its own: an inline link, Learn more, Terms, Forgot password?

    <a>
  • action.inspect

    Opens the details of a record in a table, on its name: the whole row opens it, while the other controls in the row, like its menu, still work on their own

    <button>
  • action.sort

    Sorts a table by a column: the button inside its th. Put aria-sort="ascending" or "descending" on the th of the sorted column; the arrow follows it

    <button>
  • action.upgrade

    Starts or manages paying for more: upgrade, change plan, manage billing

    <button>
  • action.more

    A link on its own to more about what is above it: Learn more, See all, Full changelog. Write only the words

    <button>
  • action.skip

    Moves to the next or previous item in a sequence someone steps through: the next track, the previous episode, the next photo in a dialog.media

    <button>

Navigation nav.*

8 intents
  • nav.home

    The site or product name, linking to the home page

    <a>
  • nav.page

    A link to a page in site or app navigation, including Sign in. Pass current on the page you are on

    <a>
  • nav.view

    Switches which view or panel of the same thing is shown: Following / For you, list / grid, a record’s Overview / Settings. Pass pressed on the active one

    <a>
  • nav.item

    The title of an item in a collection, opening its page. The link covers the item, so the whole item can be pressed; give the item position: relative

    <a>
  • nav.step

    One step in a multi-step flow. Pass current on the active step

    <a>
  • nav.paging

    One link in a layout.pager below a long list or table: a page number, Previous or Next. Pass current on the page shown

    <a>
  • nav.trail

    One link in a breadcrumb trail of the pages above this one. Put them in a nav with aria-label="Breadcrumb" and pass current on the last

    <a>
  • nav.dot

    Shows which item of a set is open, and opens that one, when the items have no titles: the photos in a dialog.media, the slides of a carousel. Pass current on the one shown, and a label like "Photo 2 of 5"

    <a>

Choice choice.*

5 intents
  • choice.option

    One of a small set of values, exactly one of which is chosen: a theme, a size, a time slot, a plan. Pass pressed on the chosen one

    <button>
  • choice.filter

    Narrows which items are shown: All, Unread, a source. Pass pressed while it applies

    <button>
  • choice.color

    Picks a colour from presets. Pass the colour as vars={{ "--choice-color": value }} and pressed on the chosen one

    <button>
  • choice.open

    Shows what is picked and opens the choices to change it: a sort order, sources. The trigger of a Popover picker

    <button>
  • choice.bulk

    Picks a row to act on together with others: the checkbox at the start of a table row. Pass pressed while picked; show a layout.toolbar of actions while any are picked

    <button>

Props

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

  • intent required

    What pressing it does: action.*, nav.* or choice.*.

    ActionIntent
  • href

    Makes it a link (through the LinkComponent in config.ts, e.g. next/link).

    string
  • pressed

    On or off, for toggles, choices and views. Sets aria-pressed; the intent styles it.

    boolean
  • current

    Marks the page or step you are on. Sets aria-current; the intent styles it.

    boolean
  • icon

    An icon shown before the text, or alone.

    ReactNode
  • label

    The accessible name. Required when there is no visible text (an icon alone).

    string
  • disabled

    Turns it off. A disabled link loses its href.

    boolean
  • type

    Buttons are type="button" unless the intent says otherwise (action.submit is submit).

    'button' | 'submit' | 'reset'
  • verb

    The verb this action performs, for analytics: verb="duplicate" sets data-verb. The intent stays the same.

    string
  • tone

    For an action that is destructive or hard to undo, like leaving a workspace. Sets data-tone; the intent styles it.

    'danger'
  • 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

  • Name it for what it does (action.delete), not how it looks. prongs check warns when its label or handler says something else.

  • State goes in pressed or current, never in a different intent or extra classes.

  • An icon alone needs label.

  • No className or style.