> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlasscripts.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Input & Confirm

> Blocking dialogs — Input collects a multi-field form, Confirm asks a yes/no question.

Two blocking dialogs for asking the player something:

* **`Bridge.Input`** — a modal form with one or more fields (text, number, select, slider, checkbox, …). Returns the entered values, or `nil` if cancelled.
* **`Bridge.Confirm`** — a yes/no dialog with an optional danger styling. Returns a boolean.

Both block until the player answers, so call them inside a thread or callback.

## Availability

Client only.

```lua theme={null}
local values = Bridge.Input.Open(opts)    -- table | nil
local ok     = Bridge.Confirm.Open(opts)  -- boolean
```

## Input

### Signature

`Bridge.Input.Open(opts)`

<ParamField path="title" type="string" default="Input">
  The dialog heading. Also accepted as `heading`.
</ParamField>

<ParamField path="icon" type="string">
  An icon shown in the header.
</ParamField>

<ParamField path="description" type="string">
  A muted sub-line under the title.
</ParamField>

<ParamField path="fields" type="table[]" required>
  The form fields, in order. Also accepted as `rows`. Each field is shaped below.
</ParamField>

<ParamField path="allowCancel" type="boolean" default="true">
  Whether the player can dismiss the form (clicking the backdrop or Cancel). When `false`, they must submit.
</ParamField>

#### Field shape

<ParamField path="fields[].type" type="string" required>
  One of `text`, `number`, `password`, `select`, `checkbox`, `slider`, `textarea`.
</ParamField>

<ParamField path="fields[].label" type="string" required>
  The field label.
</ParamField>

<ParamField path="fields[].description" type="string">
  Helper text shown under the field.
</ParamField>

<ParamField path="fields[].placeholder" type="string">
  Placeholder for text-like and select fields.
</ParamField>

<ParamField path="fields[].required" type="boolean">
  Marks the field with an accent asterisk.
</ParamField>

<ParamField path="fields[].options" type="table[]">
  For `select` fields — a list of `{ value, label }` choices.
</ParamField>

<ParamField path="fields[].min" type="number" default="0">
  For `slider` fields — the minimum value.
</ParamField>

<ParamField path="fields[].max" type="number" default="100">
  For `slider` fields — the maximum value.
</ParamField>

<ParamField path="fields[].step" type="number" default="1">
  For `slider` fields — the increment.
</ParamField>

### Returns

<ResponseField name="values" type="table | nil">
  A list-style table of the entered values **in field order** (`values[1]`, `values[2]`, …). `nil` if the player cancelled.
</ResponseField>

### Examples

<CodeGroup>
  ```lua Basic theme={null}
  CreateThread(function()
      local values = Bridge.Input.Open({
          title = 'Name your vehicle',
          fields = {
              { type = 'text',   label = 'Name', required = true },
              { type = 'number', label = 'Plate number' },
          },
      })
      if not values then return end       -- cancelled
      print(values[1], values[2])
  end)
  ```

  ```lua Mixed fields theme={null}
  local values = Bridge.Input.Open({
      title       = 'Transfer funds',
      icon        = 'bank',
      description = 'Send money to another account.',
      fields = {
          { type = 'select', label = 'Account', placeholder = 'Choose…',
            options = { { value = 'checking', label = 'Checking' }, { value = 'savings', label = 'Savings' } } },
          { type = 'slider', label = 'Amount', min = 0, max = 5000, step = 50 },
          { type = 'checkbox', label = 'Send a receipt' },
      },
      allowCancel = true,
  })
  if values then transfer(values[1], values[2], values[3]) end
  ```
</CodeGroup>

<Warning>
  `Bridge.Input.Open` yields until the player submits or cancels. Call it inside a `CreateThread`, command, or event callback.
</Warning>

## Confirm

A focused yes/no dialog. Returns `true` only if the player confirms.

### Signature

`Bridge.Confirm.Open(opts)`

<ParamField path="title" type="string" default="Are you sure?">
  The dialog heading.
</ParamField>

<ParamField path="description" type="string" default="Choose an action to continue.">
  The body text.
</ParamField>

<ParamField path="confirmLabel" type="string" default="Confirm">
  The confirm button text.
</ParamField>

<ParamField path="cancelLabel" type="string" default="Cancel">
  The cancel button text.
</ParamField>

<ParamField path="intent" type="string" default="default">
  `default` or `danger`. `danger` styles the badge and confirm button in the destructive color.
</ParamField>

### Returns

<ResponseField name="confirmed" type="boolean">
  `true` if the player confirmed, `false` if they cancelled or dismissed.
</ResponseField>

### Examples

<CodeGroup>
  ```lua Basic theme={null}
  CreateThread(function()
      if Bridge.Confirm.Open({ title = 'Drop this item?' }) then
          dropItem()
      end
  end)
  ```

  ```lua Danger intent theme={null}
  local ok = Bridge.Confirm.Open({
      title        = 'Sell vehicle?',
      description  = 'This is permanent and cannot be undone.',
      confirmLabel = 'Sell',
      cancelLabel  = 'Keep',
      intent       = 'danger',
  })
  if ok then sellVehicle() end
  ```
</CodeGroup>

<Tip>
  Both dialogs tint to the player's theme accent (the confirm badge, the required-field asterisk), and `danger` confirms use the destructive color. Set `atlas:ui "ox"` (or `atlas:ui:input` / `atlas:ui:confirm`) to render the same calls through ox\_lib instead.
</Tip>
