What are components?
metro.components holds ready-made handles to the Discord modules that render UI. Use them to build settings panels, screens, and anything else your addon draws, so it matches Discord’s own look.
Each handle is found through Metro. Most are lazy: the search runs the first time you read a property, so importing them costs nothing at startup.
Available handles
Only
Discord and Switch are typed. The rest are typed any, so check their props against Discord’s build before you rely on them.
Switch is the only handle searched for eagerly, when Unbound loads. Every other handle is a lazy proxy that resolves on first property access.The Discord design system
Build most addon UI fromDiscord. It is Discord’s mobile design system: a single module that holds its components, style factory, alert helpers, and color utilities.
Text
Text
TextandHeadingtake avariant(such as'text-md/semibold'or'heading-lg/bold'), acolor,lineClamp, and the usual view props.TextStyleSheetmaps each variant name to itsTextStyle, for when you need the style object instead of a component.
Tables and Rows
Tables and Rows
TableRowGroupis the rounded container for a list of rows. It takestitle,description, andhelperText.TableRowis the basic row:label,subLabel,icon,trailing,arrow,variant, andonPress. It has three statics:TableRow.Icon,TableRow.Arrow, andTableRow.TrailingText.TableSwitchRow,TableCheckboxRow, andTableRadioRoware rows with a built-in control.TableRowIconrenders an icon from an asset id (source) or a component (IconComponent).TableRowGroupTitle,RowButton, andRowGroupcover headings and button rows.
Inputs
Inputs
TextField,TextArea,TextAreaField,SearchField,GhostInput, andSplitTextInputare the text field family. They sharesize,status,isClearable, and leading and trailing icons or text.TextInputis Discord’s own form input, not React Native’s. It takestitle,helpText, anderror.Slider,Checkbox, andSegmentedControlcover the remaining controls.SegmentedControlis driven by astateobject.
Layout
Layout
Stackspaces its children along adirectionwith a givenspacing.Cardis a surface withvariant,border,shadow, andradius.
Color Helpers and Enums
Color Helpers and Enums
setColorOpacity,darkenColor,brightenColor, andgetContrastingColortake and return color strings.TransitionStates,ThemeContextFlags, andWCAGContrastRatiosexpose Discord’s matching constants.
DesignModule also has an index signature, so members that aren’t listed above are still reachable, typed as any. Discord’s ContextMenu is one of them.
Styles
Discord.createStyles builds a stylesheet that follows the current theme. Pass it a style object (or a function returning one) and it returns a hook. Call that hook inside your component to get the resolved styles.
Switch
Switch is Discord’s standalone toggle. Use it when you need a switch outside a TableSwitchRow.
boolean
required
Whether the switch is on.
(value: boolean) => void
required
Called with the new value when the user flips the switch.
boolean
Prevents interaction.
string
Label read by screen readers.
Other handles
These handles are untyped modules. The table shows the member Unbound uses from each one in its own UI:Portal, Forms, and HelpMessage aren’t used by Unbound itself. The table in Available handles lists the props or name each one is found by.