Skip to content

feat: render Discord Components V2#89

Merged
Yomanz merged 2 commits into
masterfrom
feat/components-v2
Jun 24, 2026
Merged

feat: render Discord Components V2#89
Yomanz merged 2 commits into
masterfrom
feat/components-v2

Conversation

@Yomanz

@Yomanz Yomanz commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

Adds rendering for Discord's Components V2 — the layout/content components that
carry visible message content (Container, Section, Text Display, Media Gallery, File,
Separator, Thumbnail). Previously only Action Rows + Buttons were rendered and
everything else in message.components was dropped.

With Components V2 a message's top-level components can be any of these (not just
Action Rows), so the dispatch was reworked to route each top-level component through a
single switch that handles both the existing interactive components and the new ones.

Components added

Type Notes
Container (17) Groups child components; renders the accent_color stripe and spoiler
Section (9) Text content paired with an accessory (Thumbnail or Button)
Text Display (10) Markdown, rendered through the existing Markdown pipeline
Media Gallery (12) Grid of images/video, per-item alt text + spoiler
File (13) Download card (name + size), reusing the attachment card styling
Separator (14) Divider line + small/large spacing
Thumbnail (11) Section accessory image

Shared additions: a reusable Spoiler (click-to-reveal) and a MediaItem (image/video)
helper. All styling uses the existing stitches theme tokens.

Action Rows, Buttons and select menus are unchanged — select menus still render as
nothing (unchanged behaviour); buttons now also render when nested inside a Container or
as a Section accessory.

⚠️ Breaking change

Bumps discord-api-types 0.37 → 0.38, which is required for the V2 component types
(APIContainerComponent, APISectionComponent, APIMessage.components as the top-level
union, etc.). 0.37 had no V2 component types. This changes the exported message/component
types, so it warrants a major release. (ButtonStyle.Premium, new in 0.38, is now mapped
in the button style table.)

Storybook

Added ComponentsV2.stories.tsx with stories for Container, Text Display, Section, Media
Gallery, File and Separators.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Yomanz Yomanz merged commit fbf490c into master Jun 24, 2026
1 check was pending
@Yomanz Yomanz deleted the feat/components-v2 branch June 24, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants