PromptDialog

A dialog that asks for one string.

import { PromptDialog } from '@textui/core';

<PromptDialog
  title="Rename"
  message="New name for this service"
  initialValue="api"
  onSubmit={(value) => console.log(value)}
  onCancel={() => {}}
/>

Props

| Prop | Type | Default | | | — | — | — | — | | title | string | | | | message | string | | | | placeholder | string | | | | initialValue | string | '' | | | mask | string | | | | onSubmit | (value: string) => void | | | | onCancel | () => void | | |

Plus everything on BoxProps.

Role: dialog.

Enter submits, escape cancels. mask turns it into a password field.

Usually reached through the app’s prompt helper rather than mounted by hand - that opens it on the modal layer and resolves a promise with the answer, which is what calling code actually wants.

See also

  • Dialog - when the answer is a choice, not a string
  • TextInput - the field inside it

Back to top

MIT licensed. Pre-1.0 - the surface is still moving.