UNPKG

jsx-slack

Version:

Build JSON object for Slack Block Kit surfaces from JSX

54 lines (53 loc) 1.58 kB
import type { BuiltInComponent } from '../../jsx-internals'; import { BlocksProps } from './utils'; /** * The basic container component for Slack Block Kit suited to * [messages](https://api.slack.com/surfaces/messages). * * `<Blocks>` can include following block elements: * * - `<Section>` (`<section>`) * - `<Image>` (`<img>`) * - `<Divider>` (`<hr>`) * - `<Header>` (`<header>`) * - `<Context>` * - `<Actions>` * - `<Input>` (`<input>`) * - `<Video>` (`<video>`) * - `<File>` * - `<Call>` * * And these input components (Require defining `label` prop): * * - `<Input label="...">` (`<input label="...">`) * - `<Textarea label="...">` (`<textarea label="...">`) * - `<Select label="...">` (`<select label="...">`) * - `<ExternalSelect label="...">` * - `<UsersSelect label="...">` * - `<ConversationsSelect label="...">` * - `<ChannelsSelect label="...">` * - `<DatePicker label="...">` * - `<TimePicker label="...">` * - `<DateTimePicker label="...">` * - `<CheckboxGroup label="...">` * - `<RadioButtonGroup label="...">` * * @example * ```jsx * api.chat.postMessage({ * channel: 'C1232456', * blocks: ( * <Blocks> * <Section>Hello, world!</Section> * </Blocks> * ), * }) * ``` * * **NOTE**: TypeScript requires to cast JSX into suited type / `any`, or wrap * with `JSXSlack(<Blocks>...</Blocks>)`. * * @return An array of block elements, for `blocks` field in * [`chat.postMessage`](https://api.slack.com/methods/chat.postMessage) API. */ export declare const Blocks: BuiltInComponent<BlocksProps>;