Skip to main content
select() declares a select menu, from any file of src/; the name of its export is its id. It takes one object, SelectConfig, and types values in run from it.
src/components/color.ts
How to write a menu and show it is in the guide. This page lists what exists. What a menu shares with a button (data, where, who, the place) is on the button() page.

select()

Declares a select menu. Export the result from any file of src/: the name of the export is what tells the menu apart, so you never write an id.

SelectDeclaration

What select() returns: a declaration the framework finds in the exports of a file. Import it where you send a message, and call it with the data it carries; a menu without data is used as is, or called with what to show.
unknown
What the file gave to select(), not checked yet.

SelectConfig

What a select file gives to select(): a menu of texts, or of things of the server.
Both have every field of InteractiveConfig and of SelectLook, plus:
number
How many things must be picked at least (0 to 25). 1 by default.
number
How many things can be picked at most (1 to 25). 1 by default.
(context: SelectContext<Picked, Data, Where>) => unknown
What to do when something is picked. Leave it out for a menu that is only waited for (message.waitForClick()).

StringSelectConfig

A menu of texts you declare.
'string'
The kind of menu: texts you declare, which is the default.
SelectOptions
required
The options (25 at most): a list of texts, an object from what is shown to what your code receives, or a list of RichOption.

EntitySelectConfig

A menu of users, roles, users and roles, or channels of the server.
EntitySelectType
required
The kind of menu: what Discord lists.
readonly ChannelType[]
For a menu of channels: the kinds of channels listed. All by default.

SelectType, EntitySelectType

The kinds of menus: texts you declare, or things of the server. Discord documentation

SelectLook

What a select menu looks like.
DynamicText<Data>
The text shown when nothing is picked (150 characters at most): written as is, or a function of t and the data, run when the message is sent. See DynamicText.
boolean
Shows the menu greyed out, impossible to use.

SelectInstanceOptions

What a message can change when it shows a menu: everything of SelectLook, plus:
readonly (string | { id: Snowflake })[]
What is picked when the menu appears: the values of the options for a menu of texts, the ids (or the things themselves) for the others.

Options

SelectOptions

The options of a menu: a list of texts (each is shown and received as is), an object whose keys are what is shown and values what your code receives, or a list of RichOption for descriptions and emojis. The same type serves the select, radio and checkboxes fields of a form.

RichOption

One option of a menu, with everything Discord shows for it.
DynamicText<Data>
required
What the person sees (100 characters at most): a text, or a function of t and the data.
string
required
What your code receives (100 characters at most).
DynamicText<Data>
A second line under the label (100 characters at most): a text, or a function of t and the data.
EmojiInput
An emoji before the label.
boolean
Shows the option as picked when the menu appears.

OptionValue

What run receives for one picked option, typed from the declaration: the union of the texts of a list, of the values of an object, or of the value of each RichOption. Discord documentation

SelectContext

What run receives when something is picked: everything of InteractiveContext, the place as PlaceOf gives it with a ComponentInteraction, and:
Picked[]
required
What was picked, in the order of the menu.
Picked | undefined
required
The first thing picked; undefined when nothing was (a menu with min: 0).
Picked is OptionValue<Options> for a menu of texts, User for 'user', Role for 'role', User | Role for 'mentionable' and Channel for 'channel'.