Components
This page documents the Ruby API for components. Values use keyword-only construction, validate before freezing, and serialize to Slack JSON.
Accordion
Combine collapsible sections in display order.
.create
Return an immutable block collection. Every section must be a collapsible container.
def self.create: (sections: Array[ContainerBlock]) -> Array[Block]
Returns: Array[Block]
Related types: Block, ContainerBlock
AccordionSection
Create one Slack-native collapsible container.
Defaults: expanded: false, width: ContainerWidth::STANDARD, has_header_divider: false; subtitle, icon and block_id omitted. Expand sections before constructing the final payload.
.create
Return a validated collapsible container. The title remains visible when collapsed.
def self.create: (title: String | PlainText, blocks: Array[Block], ?subtitle: String | Text?, ?icon: ImageElement?, ?expanded: bool, ?width: :narrow | :standard | :wide | :full, ?has_header_divider: bool, ?block_id: String?) -> ContainerBlock
Returns: ContainerBlock
Related types: Block, ContainerBlock, ImageElement, PlainText, Text
Paginator
Select one page of blocks and append navigation controls when multiple pages exist.
Defaults: page: 1, page_size: 5, previous_text: "Previous", next_text: "Next", show_page_indicator: true, block_id omitted. Pages are one-based. Actions use <prefix>.previous and <prefix>.next, with the target page in value. The application handles clicks and rebuilds the payload.
.create
Pages are one-based. Previous and next button action IDs append .previous and .next to the prefix.
def self.create: (action_id_prefix: String, blocks: Array[Block], ?page: Integer, ?page_size: Integer, ?previous_text: String, ?next_text: String, ?show_page_indicator: bool, ?block_id: String?) -> Array[Block]
Returns: Array[Block]
Related types: Block