Components
Higher-level fluent components assembled from ordinary Block Kit blocks.
Components keep their output transparent: .build() returns standard Slack
wire objects that can be inspected, rearranged, or mixed with other builders.
Accordion()
function Accordion(): FluentGroupBuilder<AccordionInput, JsonObject>;
Starts an accordion made from Slack-native collapsible containers.
Each section expands independently in Slack and requires no application-side interaction handler.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.sections(...values) | | Yes | Sections created with {@link AccordionSection}, in display order. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentGroupBuilder<AccordionInput, JsonObject>
AccordionInput
Configuration accepted by Accordion.
Properties
| Property | Type | Description |
|---|---|---|
sections | JsonObject[] | Sections created with AccordionSection, in display order. |
AccordionSection()
function AccordionSection(): FluentBuilder<AccordionSectionInput, JsonObject>;
Creates one Slack-native collapsible container for an Accordion. Set a heading and child blocks, then optionally add supporting copy, an icon, width, divider behavior, or an initially expanded state.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.title(value) | | Yes | Plain-text heading shown above the collapsible content. |
.blocks(...values) | | Yes | Blocks revealed when the section is expanded. |
.subtitle(value) | | No | Optional supporting copy below the heading. |
.icon(value) | | No | Optional image displayed in the header. |
.expanded(value) | boolean | No | Whether this section starts expanded. Defaults to false. |
.width(value) | | No | Horizontal width of this section. Defaults to standard. |
.hasHeaderDivider(value) | boolean | No | Whether Slack draws a divider below the header. |
.blockId(value) | string | No | Optional deterministic identifier for this section. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<AccordionSectionInput, JsonObject>
AccordionSectionInput
Configuration accepted by AccordionSection.
Properties
| Property | Type | Description |
|---|---|---|
blockId? | string | Optional deterministic identifier for this section. |
blocks | JsonObject[] | Blocks revealed when the section is expanded. |
expanded? | boolean | Whether this section starts expanded. Defaults to false. |
hasHeaderDivider? | boolean | Whether Slack draws a divider below the header. |
icon? | JsonObject | Optional image displayed in the header. |
subtitle? | TextLike | Optional supporting copy below the heading. |
title | TextLike | Plain-text heading shown above the collapsible content. |
width? | ContainerWidth | Horizontal width of this section. Defaults to standard. |
Paginator()
function Paginator(): FluentGroupBuilder<PaginatorInput, JsonObject>;
Starts a pure paginator component.
The component renders the selected page plus ordinary context and action blocks. Generated button values contain the one-based page to render next; interaction handling remains in the application.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.blocks(...values) | | Yes | Blocks to paginate, in display order. |
.actionIdPrefix(value) | string | Yes | Prefix used for the generated previous and next action identifiers. |
.page(value) | number | No | One-based page to render. Defaults to 1. |
.pageSize(value) | number | No | Blocks displayed per page. Defaults to 5. |
.previousText(value) | string | No | Label for the previous-page button. Defaults to Previous. |
.nextText(value) | string | No | Label for the next-page button. Defaults to Next. |
.showPageIndicator(value) | boolean | No | Whether to render Page n of m above the controls. Defaults to true. |
.blockId(value) | string | No | Optional identifier for the generated actions block. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentGroupBuilder<PaginatorInput, JsonObject>
PaginatorInput
Configuration accepted by Paginator.
Properties
| Property | Type | Description |
|---|---|---|
actionIdPrefix | string | Prefix used for the generated previous and next action identifiers. |
blockId? | string | Optional identifier for the generated actions block. |
blocks | JsonObject[] | Blocks to paginate, in display order. |
nextText? | string | Label for the next-page button. Defaults to Next. |
page? | number | One-based page to render. Defaults to 1. |
pageSize? | number | Blocks displayed per page. Defaults to 5. |
previousText? | string | Label for the previous-page button. Defaults to Previous. |
showPageIndicator? | boolean | Whether to render Page n of m above the controls. Defaults to true. |