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

# Modern UI - Alert

> Alert dialogs used for confirmations, warnings, info messages and more.

Alert dialogs provide a flexible way to show confirmations, warnings, informational messages, and more with support for markdown content, custom icons, and styled callouts.

## Quick Start

```lua theme={null}
local result = exports.lation_ui:alert({
    header = 'Delete Item',
    content = 'Are you sure you want to delete this item?',
    icon = 'fas fa-trash',
    iconColor = '#EF4444',
    type = 'error'
})

if result == 'confirm' then
    print('Item deleted!')
end
```

## Functions

<AccordionGroup>
  <Accordion title="alert(data) → string" icon="code">
    Opens an alert dialog and waits for user interaction.

    **Returns:**

    * `'confirm'` - User clicked the confirm button
    * `'cancel'` - User clicked cancel or closed the dialog

    ```lua theme={null}
    local result = exports.lation_ui:alert({
        header = 'Confirm Action',
        content = 'Do you want to continue?'
    })
    ```
  </Accordion>

  <Accordion title="closeAlert()" icon="xmark">
    Programmatically closes any currently open alert dialog.

    ```lua theme={null}
    exports.lation_ui:closeAlert()
    ```
  </Accordion>
</AccordionGroup>

## Configuration

### Dialog Options

<ParamField body="header" type="string">
  The dialog header text. Supports markdown formatting.

  <Note>
    Either `header` or `content` must be provided.
  </Note>
</ParamField>

<ParamField body="content" type="string">
  The main content text displayed in the dialog. Supports markdown formatting.

  <Note>
    Either `header` or `content` must be provided.
  </Note>
</ParamField>

<ParamField body="icon" type="string">
  FontAwesome icon class (e.g., `'fas fa-trash'`, `'fas fa-info-circle'`).
</ParamField>

<ParamField body="iconColor" default="#71717A" type="string">
  Icon color using hex code or [CSS color name](https://htmlcolorcodes.com/color-names/).

  ```lua theme={null}
  iconColor = '#EF4444'  -- Hex code
  iconColor = 'red'      -- CSS color name
  ```
</ParamField>

<ParamField body="type" default="default" type="string">
  Dialog type that affects the overall styling.

  **Options:** `'default'`, `'info'`, `'success'`, `'warning'`, `'error'`
</ParamField>

<ParamField body="size" default="md" type="string">
  Dialog size for responsive layouts.

  **Options:** `'xs'`, `'sm'`, `'md'`, `'lg'`, `'xl'`
</ParamField>

<ParamField body="cancel" default="true" type="boolean">
  Whether to show the cancel button.
</ParamField>

<ParamField body="labels" default="{ cancel = 'Cancel', confirm = 'Confirm' }" type="table">
  Custom button labels for custom text.

  ```lua theme={null}
  labels = {
      cancel = 'No',
      confirm = 'Yes'
  }
  ```
</ParamField>

<ParamField body="callouts" type="table">
  Array of callout objects to highlight important information within the dialog.

  See [Callouts](#callouts) section below for detailed options.
</ParamField>

### Callouts

Callouts are styled information boxes that can be added to alert dialogs to emphasize critical information.

<ParamField body="description" type="string" required>
  The callout content text. Supports markdown formatting.
</ParamField>

<ParamField body="label" type="string">
  The callout title/header. Supports markdown formatting.
</ParamField>

<ParamField body="type" default="info" type="string">
  Callout styling type.

  **Options:** `'info'`, `'success'`, `'warning'`, `'error'`
</ParamField>

<ParamField body="icon" type="string">
  Custom FontAwesome icon. Inherits the color from the callout type.

  ```lua theme={null}
  icon = 'fas fa-rocket'
  ```
</ParamField>

## Preview

<Frame>
  <img src="https://mintcdn.com/lationscripts/Ti0acW9JT3q4BC3Y/resources/modern-ui/components/alert-dialog/destructive-example.webp?fit=max&auto=format&n=Ti0acW9JT3q4BC3Y&q=85&s=f074247312d73a4abfb8ddebbb6e4cc5" alt="Alert dialog example" width="904" height="408" data-path="resources/modern-ui/components/alert-dialog/destructive-example.webp" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/lationscripts/Ti0acW9JT3q4BC3Y/resources/modern-ui/components/alert-dialog/callouts-example.webp?fit=max&auto=format&n=Ti0acW9JT3q4BC3Y&q=85&s=7c190ac5dde1343ed59be73ad680af0f" alt="Alert dialog callouts example" width="904" height="1204" data-path="resources/modern-ui/components/alert-dialog/callouts-example.webp" />
</Frame>
