# Widgets Overview > Build interactive UI that your AI agent shows inline in conversations: forms, cards, tables, charts and more. ## What are Widgets? Widgets are interactive UI components that your AI agent shows inside a conversation. Instead of answering in plain text, the agent displays a card, a form, a table, a chart or a set of buttons right in the chat. With a Widget, your agent can collect structured details, present data clearly and let visitors act, without leaving the conversation. You'll find your Widgets under **Build › Widgets**. ![The Widgets page with the My Widgets tab open, the Search widgets box, the All filter, and Widget cards such as Order status with their Edit and more-actions buttons.](annotated/01-widgets-list.webp "Build › Widgets lists every Widget in the agent.") ## What You Can Do with Widgets > [card] Collect Structured Input | /docs/developer-guides/widgets/components/form-inputs | Build forms with text fields, dropdowns, date pickers, checkboxes and radio buttons to gather details from visitors. > [card] Display Rich Content | /docs/developer-guides/widgets/components/data-display | Show cards, tables, charts, images and Markdown text to present information clearly. > [card] Trigger Actions | /docs/developer-guides/widgets/functions | Connect buttons and form submissions to API calls, chat messages, links or variable updates. > [card] React to User Input | /docs/developer-guides/widgets/states | Show, hide or switch views based on the Widget's current values. > [card] Import and Export | /docs/developer-guides/widgets/overview#import-and-export | Move Widgets between agents and teams as `.widget` files. > [card] AI-Assisted Building | /docs/developer-guides/widgets/ai-widget-builder | Describe a Widget in plain language or start from a template. ## Key Concepts These are the parts every Widget is made of. | Concept | Description | | - | - | | **Code** | The Widget's layout, written with the built-in [components](/docs/developer-guides/widgets/components/layout). | | **Schema** | The data fields the Widget expects, and their types. | | **Default** | The values every field starts with when the Widget first shows. | | **Examples** | Saved sets of data for previewing other scenarios in the builder. | | **Functions** | What happens when a visitor clicks a button, submits a form or changes a field. | | **States** | Named groups of elements that show or hide based on the Widget's current values. | > [!NOTE] > > The **Schema** tells your AI agent what data to pass into the Widget. Each field in the schema becomes a variable you can use in the Widget's code. ## Connecting Widgets to Actions A Widget appears in a conversation through an **Action**. Build the Widget under **Build › Widgets**, then attach it to a [Custom Action](/docs/user-guides/chatbot/actions/custom-action). When you create the Custom Action, choose **Call API + show widget** or **Show widget** as the action type. > [tab] Show widget > > This type has **no API URL**. The Widget gets its data straight from the details the AI agent collects. > > Choose what the agent collects before it shows the Widget: > > * **All widget variables**: the agent collects every field in the Widget's schema. > * **Only the variables I choose**: the agent collects only the variables you list. Anything else keeps the Widget's default value. > > **Best suited for:** > > * Forms that collect details from visitors > * Information cards and menus > * Interactive elements that don't need outside data > [tab] Call API + show widget > > This type has an **API URL**. The Action calls your API first, then shows the Widget with the response. > > **Best suited for:** > > * Lookups, such as order status or account details > * Live data, such as stock levels or analytics > * Multi-step tasks that depend on your server's logic > [!TIP] > > After you click **Create** in the builder, the **Widget successfully created** dialog offers **Add to an Action**, which takes you straight to choosing one. ### Data Flow for Call API Actions **1. The AI agent runs the Action** The agent decides to run the Action and gathers the inputs it needs. **2. The Action calls your API** The Action sends a request to your API URL with those inputs. **3. Your API responds** Your server handles the request and returns a JSON response. **4. The response is merged with the Action's inputs** The API response is combined with the inputs. When both have the same field, the API response wins. **5. The Widget shows the combined data** The Widget receives the merged data and renders it in the chat. ## Where Widget Data Comes From A Widget's data can come from several places. Higher-priority sources override lower ones. | Priority | Source | Description | | - | - | - | | 1 (lowest) | **Default** | The Widget's default values from the builder. | | 2 | **Action input** | The details the AI agent collected for the Action. | | 3 (highest) | **API response** | The data your API returned (Call API actions only). | > [!NOTE] > > When a field is in both the Action input and the API response, the API response value is used. Default values are used only for fields no other source provides. ## File Uploads Widgets can take files from the visitor and send them straight to an endpoint you control, then show or reuse the uploaded file's URL. Add an **Upload file** function to a button. See [File Uploads](/docs/developer-guides/widgets/file-uploads). ## Import and Export Share Widgets between agents, teams or projects as `.widget` files. > [accordion] Exporting a Widget > > 1. Open the Widget in the builder. > 2. Click the **⋯** menu in the top-right corner. > 3. Select **Download** to save the Widget as a `.widget` file. > > The file holds the Widget's code, schema, default values, examples, functions and states. > [accordion] Importing a Widget > > 1. Go to **Build › Widgets** and open the **Create Widgets** tab. > 2. Click **Upload Widget**. > 3. Choose a `.widget` file of up to 1 MB. > > The Widget opens in the builder. Click **Create** to save it, then attach it to any Action. ![The Widget options menu open from the ⋯ button in the builder, listing Add to an Action, Download, Upload and Delete Widget.](annotated/03-widget-options.webp "Download and Upload are in the Widget options menu.") ![The Install Widget from file dialog, warning to only install Widgets from sources you trust, with Drop a .widget file here or click to browse and JSON files up to 1MB.](annotated/04-upload-widget.webp "Upload Widget installs a .widget file.") > [!WARNING] > > Only install Widgets from sources you trust: a Widget file can contain code that runs in your agent. A `.widget` file also doesn't include any Action settings. After importing, attach the Widget to an Action and set up where its data comes from. ## Next steps > [card] AI Widget Builder | /docs/developer-guides/widgets/ai-widget-builder | Generate a Widget by describing it. > [card] Code Editor | /docs/developer-guides/widgets/code-editor | Write the Widget's layout, schema and examples. > [card] Functions | /docs/developer-guides/widgets/functions | Decide what each button and form does.