Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 1.64 KB

File metadata and controls

55 lines (41 loc) · 1.64 KB
title Select
description Dropdown control in a bot message with an inline onSelect handler.

Overview

Select is a dropdown for an Actions row. The selection handler is inline, like Button's onClick; the selected option's value arrives as a string.

Import

import { Select } from "@copilotkit/bot-ui";

Props

Inline handler run on selection. `ctx.action.value` is the chosen option's `value` (a `string`). See [`InteractionContext`](/reference/bot/types/InteractionContext). Must return `void` or `Promise`. Placeholder shown before a selection is made. The selectable options (`SelectOption[]`).

Usage

<Actions>
  <Select
    placeholder="Pick a severity"
    options={[
      { label: "SEV1 — page someone", value: "sev1" },
      { label: "SEV2 — business hours", value: "sev2" },
      { label: "SEV3 — backlog", value: "sev3" },
    ]}
    onSelect={async ({ thread, action }) => {
      await thread.post(`Severity set to ${action.value}.`);
    }}
  />
</Actions>

On Slack

Renders as a static_select element — at most 100 options (SLACK_LIMITS.selectOptions).

Related