prongs
GitHub

field.text

Short free text on one line: names, titles, handles

Component

Renders

<input type="text">

Profile

Comes from

starter
Read https://www.prongs.dev/docs/intents/field/text.md and tell me whether field.text fits what I am building.

Example

Preview
<Field intent="field.text" label="Display name" value={name} onChange={(e) => setName(e.target.value)} />

Connections

Choosing between neighbours

  • If it is

    Use

  • Short free text on one line: names, titles, handles

    field.text
  • More than one line

    field.multiline
  • Usernames or handles

    rather than field.email
    field.text
  • Other secrets that may be shown, like API keys

    rather than field.password
    field.text
  • Codes made of digits, like postcodes or phone numbers

    rather than field.number
    field.text
  • Paths or handles

    rather than field.url
    field.text
  • Free text

    rather than field.select
    field.text
  • A colour typed as text, like a hex code

    rather than field.color
    field.text

For registry authors

Starter intents. These are the intents prongs add puts in your registry, shown in this site’s theme. Yours are your own registry.ts: rename, restyle and add to them, and see them with prongs add gallery.

What this intent is built from and its entry in components/prongs/registry.ts. You only need this to change how it looks or to add an intent like it.

How field.text resolves, and its definition

Each layer adds to the one before it; a later class wins over an earlier one that sets the same thing.

  • input.default

    Bordered input box

    w-full min-w-0 rounded-md border border-input bg-background pl-3
    pr-3 py-2 text-base text-foreground
    placeholder:text-surface-muted focus-visible:outline-none
    focus-visible:ring-2 focus-visible:ring-ring
    disabled:cursor-not-allowed disabled:opacity-50
    aria-invalid:border-destructive
  • field.text

    Short free text on one line: names, titles, handles

Final classes
w-full min-w-0 rounded-md border border-input bg-background pl-3
pr-3 py-2 text-base text-foreground
placeholder:text-surface-muted focus-visible:outline-none
focus-visible:ring-2 focus-visible:ring-ring
disabled:cursor-not-allowed disabled:opacity-50
aria-invalid:border-destructive
Element behaviour
{ type: 'text' }
Definition
TS
'field.text': {
kind: 'semantic',
description: 'Short free text on one line: names, titles, handles',
refs: ['input.default'],
binding: { behavior: { type: 'text' } },
notFor: [{ context: 'more than one line', instead: 'field.multiline' }],
},