# Using Modal Components

## Overview

Modal components are a great way to collect freeform information from your users.

### Prerequisites

- You must have a Discord account and be a member of the Discord Developer Portal.
- You must have a Discord application created in the Discord Developer Portal.

***

## Displaying a Modal

Displaying a modal can be done in response to an [interaction](/guides/interactions-receiving-and-responding). When displaying a modal you'll use an [interaction response](/guides/interactions-receiving-and-responding#interaction-response-object) with the [`MODAL`](/guides/interactions-receiving-and-responding#interaction-callback-type) interaction callback type and [modal fields](/guides/interactions-receiving-and-responding#modal).

An example of a modal with a [String Select](/guides/components-reference#string-select) and [Text Input](/guides/components-reference#text-input) both wrapped in [Labels](/guides/components-reference#label):

```json
{
  "type": 9,
  "data": {
    "custom_id": "bug_modal",
    "title": "Bug Report",
    "components": [
      {
        "type": 18,
        "label": "What's your favorite bug?",
        "component": {
          "type": 3,
          "custom_id": "bug_string_select",
          "placeholder": "Choose...",
          "options": [
            {
              "label": "Ant",
              "value": "ant",
              "description": "(best option)",
              "emoji": {
                "name": "🐜"
              }
            },
            {
              "label": "Butterfly",
              "value": "butterfly",
              "emoji": {
                "name": "🦋"
              }
            },
            {
              "label": "Caterpillar",
              "value": "caterpillar",
              "emoji": {
                "name": "🐛"
              }
            }
          ]
        }
      },
      {
        "type": 18,
        "label": "Why is it your favorite?",
        "description": "Please provide as much detail as possible!",
        "component": {
          "type": 4,
          "custom_id": "bug_explanation",
          "style": 2,
          "min_length": 1000,
          "max_length": 4000,
          "placeholder": "Write your explanation here...",
          "required": true
        }
      }
    ]
  }
}
```

![Example of an Action Row with three buttons](../img/images/components/modal.webp)

## Related pages

- [API Reference](./api-reference-index.md)
- [App Fundamentals](./app-fundamentals-index.md)
- [Best Practices](./best-practices-index.md)
- [Bots & Companion Apps](./bots-companion-apps-index.md)
- [Building Games](./building-games-index.md)
- [Building on Discord](./building-on-discord-index.md)
- [Change Log](./change-log-index.md)
- [Communities & Servers](./communities-servers-index.md)
- [Components](./components-index.md)
- [Core Concepts](./core-concepts-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
