Skip to main content

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.

SetterValue typeRequiredDescription
.sections(...values)
JsonObject[]
YesSections 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

PropertyTypeDescription
sectionsJsonObject[]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.

SetterValue typeRequiredDescription
.title(value)
TextLike
YesPlain-text heading shown above the collapsible content.
.blocks(...values)
JsonObject[]
YesBlocks revealed when the section is expanded.
.subtitle(value)
TextLike
NoOptional supporting copy below the heading.
.icon(value)
JsonObject
NoOptional image displayed in the header.
.expanded(value)booleanNoWhether this section starts expanded. Defaults to false.
.width(value)
ContainerWidth
NoHorizontal width of this section. Defaults to standard.
.hasHeaderDivider(value)booleanNoWhether Slack draws a divider below the header.
.blockId(value)stringNoOptional 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

PropertyTypeDescription
blockId?stringOptional deterministic identifier for this section.
blocksJsonObject[]Blocks revealed when the section is expanded.
expanded?booleanWhether this section starts expanded. Defaults to false.
hasHeaderDivider?booleanWhether Slack draws a divider below the header.
icon?JsonObjectOptional image displayed in the header.
subtitle?TextLikeOptional supporting copy below the heading.
titleTextLikePlain-text heading shown above the collapsible content.
width?ContainerWidthHorizontal 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.

SetterValue typeRequiredDescription
.blocks(...values)
JsonObject[]
YesBlocks to paginate, in display order.
.actionIdPrefix(value)stringYesPrefix used for the generated previous and next action identifiers.
.page(value)numberNoOne-based page to render. Defaults to 1.
.pageSize(value)numberNoBlocks displayed per page. Defaults to 5.
.previousText(value)stringNoLabel for the previous-page button. Defaults to Previous.
.nextText(value)stringNoLabel for the next-page button. Defaults to Next.
.showPageIndicator(value)booleanNoWhether to render Page n of m above the controls. Defaults to true.
.blockId(value)stringNoOptional 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

PropertyTypeDescription
actionIdPrefixstringPrefix used for the generated previous and next action identifiers.
blockId?stringOptional identifier for the generated actions block.
blocksJsonObject[]Blocks to paginate, in display order.
nextText?stringLabel for the next-page button. Defaults to Next.
page?numberOne-based page to render. Defaults to 1.
pageSize?numberBlocks displayed per page. Defaults to 5.
previousText?stringLabel for the previous-page button. Defaults to Previous.
showPageIndicator?booleanWhether to render Page n of m above the controls. Defaults to true.