# `Drafter.Prompt.Text`
[🔗](https://github.com/jaman/drafter/blob/v0.6.0/lib/drafter/prompt/text.ex#L1)

The component behind `Drafter.Prompt.text/2`, `password/2`, `number/2` and
`readline/2`: one line of text with editing keys, history and Tab completion.

## Options

  * `:label` - the question, or the prompt string when `:plain` is set
  * `:default` - the value used when the line is submitted empty
  * `:placeholder` - dimmed text shown while the line is empty
  * `:validate` - `(value -> :ok | {:error, message})`, run on submit
  * `:parse` - `(text -> {:ok, value} | {:error, message})`, run on submit before
    `:validate`; the prompt returns `value`
  * `:complete` - a `t:Drafter.Prompt.Completion.source/0` for Tab
  * `:history` - earlier lines, newest first, recalled with Up and Down
  * `:mask` - a character shown in place of every typed one
  * `:plain` - `true` draws only the label and the line, and leaves both on screen
    unchanged when the prompt ends
  * `:limit` - the most completion candidates listed at once. Default
    `config :drafter, prompt_limit: 7`

## Keys

Enter submits. Esc stops the prompt with `:cancelled`, and Ctrl+D on an empty line
stops it with `:eof`. Up and Down recall history. Tab completes: one candidate is
inserted, and several are listed, after which Tab, Shift+Tab, Up and Down step
through them, Enter keeps the chosen one and Esc closes the list. Every other key is
an editing key of `Drafter.Prompt.Editor`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
