Exported types
All types ship from the package entry. Payload shapes extend Slack's official
@slack/types definitions, so payloads typed for the Slack SDK type-check
against the renderer without conversion.
Payloads
| Type | Shape |
|---|---|
BlockKitInput | Everything <BlockKit /> accepts: BlockKitData, a JSON string, readonly unknown[], or { blocks: readonly unknown[] } |
BlockKitData | readonly RenderableBlock[] | BlockKitPayload; the validated form returned by parseBlockKitData |
BlockKitPayload | { readonly blocks: readonly RenderableBlock[] } |
RenderableBlock | Union of every supported block type |
BlockKitSurface | "message" | "modal" | "home" |
BlockKitTheme | "light" | "dark" |
Use satisfies to keep literal payloads checked while preserving their
inferred shape:
import type { BlockKitData } from "react-blockkit";
export const payload = {
blocks: [{ type: "section", text: { type: "mrkdwn", text: "Typed end to end." } }],
} satisfies BlockKitData;Use BlockKitData for payloads authored against the supported type inventory.
Use the wider BlockKitInput boundary for editor/API JSON that still needs
tolerant rendering. Do not cast an unknown future discriminator to
BlockKitData: the renderer can display it through an unvalidated array or
{ blocks } input, while strict validation correctly rejects it.
Per-block data types
Every block type has a corresponding …Data type, the exact shape its
component accepts: ActionsBlockData, AlertBlockData, CardBlockData,
CarouselBlockData, ContainerBlockData, ContextBlockData,
ContextActionsBlockData, DataTableBlockData, DataVisualizationBlockData,
DividerBlockData, FileBlockData, HeaderBlockData, ImageBlockData,
InputBlockData, MarkdownBlockData, PlanBlockData, RichTextBlockData,
SectionBlockData, TableBlockData, TaskCardBlockData, and
VideoBlockData.
Element and text-object shapes follow the same pattern:
ButtonElementData, ImageElementData, InteractiveElementData,
OptionData, and TextObjectData. All of these are deeply readonly.
Interactions and resolvers
| Type | Shape |
|---|---|
BlockKitAction | { actionId, type, blockId?, value?, values? }; see Handling actions |
BlockKitResolvers | Optional user, channel, usergroup, team, emoji, date, and imageSize functions; see Resolvers and mentions |
Errors and tokens
| Type | Shape |
|---|---|
BlockKitInvariantCode | Union of the stable error codes listed in the validation reference |
BlockKitInvariantDetails | { code, path }; the constructor details for BlockKitInvariantError |
MrkdwnToken | Discriminated union produced by tokenizeMrkdwn |
BlockKitInvariantError and isBlockKitInvariantError() are value exports.
Prefer the guard when catching errors because ESM and CommonJS consumers can
load distinct copies of the class.
Component props
Named props interfaces exported from the package entry are BlockKitProps,
BlockKitProviderProps, BlockComponentProps<TBlock>, BlockProps,
ButtonElementProps, ImageElementProps, InputElementProps,
InteractiveElementProps, OverflowElementProps, SelectElementProps,
TableCellProps, MarkdownProps, MrkdwnProps, RichTextProps, and
TextProps.
Re-exports from @slack/types
For convenience, commonly used SDK types are re-exported unchanged:
ActionsBlock, AlertBlock, Button, Checkboxes, ContextActionsBlock,
ContextBlock, DividerBlock, FileBlock, ImageBlock, ImageElement,
InputBlock, MarkdownBlock, Option, PlainTextElement, PlanBlock,
RichTextElement, SectionBlock, TaskCardBlock, TextObject, and
VideoBlock.