Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.8 KB

File metadata and controls

56 lines (41 loc) · 1.8 KB
title Input
description Text input control in a bot message with an inline onSubmit handler.

Overview

Input is a free-text control. The submitted text arrives in the inline onSubmit handler as a string. Place it as a direct child of Message (a sibling of Section / Actions) — on Slack it renders as its own input block, and an Input placed inside an Actions row is dropped by the renderer.

Import

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

Props

Inline handler run on submit. `ctx.action.value` is the entered text. See [`InteractionContext`](/reference/bot/types/InteractionContext). Must return `void` or `Promise`. Placeholder text shown while empty. Render as a multi-line text area. Identifier for the input. Currently unused by the Slack adapter.

Usage

<Message>
  <Section>Anything to add before I file this?</Section>
  <Input
    placeholder="Add a note for the postmortem…"
    multiline
    onSubmit={async ({ thread, action }) => {
      await thread.post(`Noted: ${action.value}`);
    }}
  />
</Message>

On Slack

Renders as an input block wrapping a plain_text_input element. Must be a top-level block — inside an Actions row the Slack renderer silently drops it.

Related