Display Components (Components V2) allow you to create messages with various layout and content options. This provides you with more flexibility in designing and formatting your app's messages beyond simple text or embeds.
You cannot include regular message content, embeds, stickers, or polls when using display components.
Table of Contents
Text Display
Text Display components add simple text with Markdown formatting support to your message. Total text across all such components must not exceed 4,000 characters. Use $addTextDisplay[] to create a new Text Display component.
Text Display components can also be used in modals.
Example
$addTextDisplay[This is a **Text Display** component!]
Section
Sections group up to three Text Display components and require an accessory. The accessory must either be a Thumbnail or Button component. At least one Text Display component is required. Use $addSection[] to create a new Section component.
If you do not want to include an accessory, use a Text Display component instead.
Thumbnail Accessory
A Thumbnail component is visually similar to embed thumbnails. It can exclusively be added as accessory inside a Section component, supports alt text (description) and can be marked as a spoiler. Use $addThumbnail[] to create a new Thumbnail component.
Example
$addSection[
$addTextDisplay[This is a **Text Display** component inside a **Section** component with **Thumbnail** accessory!]
$addThumbnail[$userAvatar[$botID]]
]
Button Accessory
A Button is an interactive message component. It can be added as single accessory inside a Section component and does not need to be grouped in an action row. Use $addButton[] to create a new Button component.
Example
$addSection[
$addTextDisplay[This is a **Text Display** component inside a **Section** component!]
$addTextDisplay[It has an interactive **Button** accessory attached!]
$addButton[click;Click Me;Primary]
]
Media Gallery
The Media Gallery allows to display a grid of up to 10 media items, similar to attachments. Each media item can either be an image, video, or GIF, with optional alt text (description) and the option to mark it as a spoiler. Use $addMediaGallery[] and $addMediaItem[] to create a new Media Gallery component with one or multiple media items.
Example
$addMediaGallery[
$addMediaItem[$userAvatar[$botID]]
$addMediaItem[$guildIcon;Server Icon as Spoiler;true]
]
File
File components embed a single file in the message body. They don’t support alt text (description) but can be marked as spoilers. Adding files requires using $attachment[] along with the attachment:// format. Use $addFile[] to create a new File component.
Example
$attachment[data/example.json;file.json]
$addFile[attachment://file.json]
Separator
Separators are display components that insert vertical spacing and an optional visual divider line between components. You can choose the spacing size (Small or Large) for the Separator component, as well as whether to display the divider line (defaults to true). Use $addSeparator[] to create a new Separator component.
Example
$addTextDisplay[This is a **Text Display** component __above__ the **Separator** component!]
$addSeparator[Large;false]
$addTextDisplay[This is a **Text Display** component __below__ the **Separator** component!]
Container
Containers are optional and wrap multiple child components inside a styled rounded box with an optional accent color, similar to embeds. They can include all above mentioned display components and action rows (message components). Containers also support spoilering the entire block. Use $addContainer[] to create a new Container component.
You can use multiple Container components within a single message.
Example
$addContainer[
$addTextDisplay[This is a **Text Display** component inside a **Container** component!]
$addActionRow
$addChannelSelectMenu[channelMenu;Select channels]
$addSeparator
$addSection[
$addTextDisplay[This is a **Text Display** component inside a **Section** component, located in a **Container** component!]
$addTextDisplay[It has an interactive **Button** accessory attached!]
$addButton[click;Click Me;Primary]
]
;#552dd0]