Skip to content
// EFFECT DAYS 2026

ChatUi unstable

The plain elements of buttons, selects and modals.

These are what goes on the wire, into ChatTest and into storage. Every element is a Schema tagged struct and every value in one is already a string. ChatInteraction holds the typed definitions that build them and receive their clicks. A consumer that routes clicks itself builds them with each schema's own make.

Details

  • post and edit take a flat list of Actions beside the Markdown, and the adapter lays out the rows.
  • Text in a modal is plain, not Markdown, because a Slack modal cannot hold a markdown block.
23 exports Since v4.1.5 Source

Constructors

linkButton

unstable
Since v4.1.5

Creates a button that opens a URL.

When to use

Use to put a link beside the buttons of a message. It is the one element with no definition in ChatInteraction, since it produces no click.

Signature

declare function linkButton(options: {
readonly label: string;
readonly url: string;
}): {
readonly _tag: "LinkButton";
readonly label: string;
readonly url: string;
}

Example Posting a link button

import { Effect } from "effect"
import { Chat, ChatThread, ChatUi } from "effect/chat"
const program = Effect.gen(function*() {
const chat = yield* Chat.Chat
yield* chat.post(ChatThread.make("slack", "T1/C1"), {
markdown: "The diff is ready.",
actions: [ChatUi.linkButton({ label: "Diff", url: "https://example.com/diff" })]
})
})

Models

Action

type unstable
Since v4.1.5

What post and edit take in actions: a button, a link button or a select.

Signature

type Action = typeof Action.Type

Button

type unstable
Since v4.1.5

A button on a message.

Signature

type Button = typeof Button.Type

ButtonStyle

type unstable
Since v4.1.5

The style of a button.

Signature

type ButtonStyle = typeof ButtonStyle.Type

LinkButton

type unstable
Since v4.1.5

A button that opens a URL.

Signature

type LinkButton = typeof LinkButton.Type

ModalElement

type unstable
Since v4.1.5

One element of a modal: a text input, a select or plain text.

Signature

type ModalElement = typeof ModalElement.Type

Select

type unstable
Since v4.1.5

A single-choice select on a message.

Signature

type Select = typeof Select.Type

SelectInput

type unstable
Since v4.1.5

A single-choice select in a modal.

Signature

type SelectInput = typeof SelectInput.Type

SelectOption

type unstable
Since v4.1.5

One option of a select.

Signature

type SelectOption = typeof SelectOption.Type

Text

type unstable
Since v4.1.5

Plain text in a modal.

Signature

type Text = typeof Text.Type

TextInput

type unstable
Since v4.1.5

A text input in a modal.

Signature

type TextInput = typeof TextInput.Type

Schemas

Action

unstable
Since v4.1.5

Schema for what post and edit take in actions.

Signature

declare const Action: Union<readonly [TaggedStruct<"Button", {
readonly id: String;
readonly label: String;
readonly style: optionalKey<Literals<readonly ["default", "primary", "danger"]>>;
readonly value: optionalKey<String>;
}>, TaggedStruct<"LinkButton", {
readonly label: String;
readonly url: String;
}>, TaggedStruct<"Select", {
readonly id: String;
readonly options: $Array<Struct<{
readonly label: String;
readonly value: String;
}>>;
readonly placeholder: optionalKey<String>;
readonly selected: optionalKey<String>;
}>]>

Button

unstable
Since v4.1.5

Schema for a button on a message.

Details

value is the encoded value, absent when the definition has no value schema.

Signature

declare const Button: TaggedStruct<"Button", {
readonly id: String;
readonly label: String;
readonly style: optionalKey<Literals<readonly ["default", "primary", "danger"]>>;
readonly value: optionalKey<String>;
}>

ButtonStyle

unstable
Since v4.1.5

Schema for the style of a button.

Signature

declare const ButtonStyle: Literals<readonly ["default", "primary", "danger"]>

LinkButton

unstable
Since v4.1.5

Schema for a button that opens a URL.

Details

It produces no click, so it has no id and no handler.

Signature

declare const LinkButton: TaggedStruct<"LinkButton", {
readonly label: String;
readonly url: String;
}>
Since v4.1.5

Schema for one element of a modal.

Signature

declare const ModalElement: Union<readonly [TaggedStruct<"TextInput", {
readonly id: String;
readonly initial: optionalKey<String>;
readonly label: String;
readonly maxLength: optionalKey<Int>;
readonly minLength: optionalKey<Int>;
readonly multiline: optionalKey<Boolean>;
readonly optional: optionalKey<Boolean>;
readonly placeholder: optionalKey<String>;
}>, TaggedStruct<"SelectInput", {
readonly id: String;
readonly initial: optionalKey<String>;
readonly label: String;
readonly optional: optionalKey<Boolean>;
readonly options: $Array<Struct<{
readonly label: String;
readonly value: String;
}>>;
readonly placeholder: optionalKey<String>;
}>, TaggedStruct<"Text", {
readonly text: String;
}>]>

Select

unstable
Since v4.1.5

Schema for a single-choice select on a message.

Details

selected is the value of the option shown as chosen.

Signature

declare const Select: TaggedStruct<"Select", {
readonly id: String;
readonly options: $Array<Struct<{
readonly label: String;
readonly value: String;
}>>;
readonly placeholder: optionalKey<String>;
readonly selected: optionalKey<String>;
}>

SelectInput

unstable
Since v4.1.5

Schema for a single-choice select in a modal.

Details

Both ChatInteraction.choice and ChatInteraction.selectInput fields become this. initial is the value of the option chosen when the modal opens.

Signature

declare const SelectInput: TaggedStruct<"SelectInput", {
readonly id: String;
readonly initial: optionalKey<String>;
readonly label: String;
readonly optional: optionalKey<Boolean>;
readonly options: $Array<Struct<{
readonly label: String;
readonly value: String;
}>>;
readonly placeholder: optionalKey<String>;
}>
Since v4.1.5

Schema for one option of a select. value is the encoded value.

Signature

declare const SelectOption: Struct<{
readonly label: String;
readonly value: String;
}>

Text

unstable
Since v4.1.5

Schema for plain text in a modal.

Details

Not Markdown: a Slack modal cannot hold a markdown block.

Signature

declare const Text: TaggedStruct<"Text", {
readonly text: String;
}>

TextInput

unstable
Since v4.1.5

Schema for a text input in a modal, one line or several.

Signature

declare const TextInput: TaggedStruct<"TextInput", {
readonly id: String;
readonly initial: optionalKey<String>;
readonly label: String;
readonly maxLength: optionalKey<Int>;
readonly minLength: optionalKey<Int>;
readonly multiline: optionalKey<Boolean>;
readonly optional: optionalKey<Boolean>;
readonly placeholder: optionalKey<String>;
}>