Slackblocks.Blocks.Container (slackblocks v2.8.0)

View Source

A titled group of blocks that can optionally collapse.

Slack reference: https://docs.slack.dev/reference/block-kit/blocks/container-block

Fields

  • child_blocks — Adds the blocks grouped inside the container, in display order. Required.
  • title — Sets the container title. Provide either a title or a rich text title. Optional; nil omits the field.
  • rich_text_title — Sets a rich text block used as the title in place of a plain-text title. Optional; nil omits the field.
  • subtitle — Sets the supporting text shown below the title. Optional; nil omits the field.
  • width — Sets the horizontal width of the container. Optional; nil omits the field.
  • icon — Sets the image displayed beside the title. Optional; nil omits the field.
  • is_collapsible — Sets whether users can collapse and expand the container. Optional; nil omits the field.
  • default_collapsed — Sets whether a collapsible container starts collapsed. Requires the container to be collapsible. Optional; nil omits the field.
  • has_header_divider — Sets whether Slack draws a divider below the container header. Only valid for non-collapsible containers. Optional; nil omits the field.
  • block_id — Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again. Optional; nil omits the field.

Summary

Functions

Atomically replaces supplied fields; omitted fields retain their values.

Constructs and validates a value. Text conveniences apply to keyword input.

Constructs a value or raises Slackblocks.ValidationError.

Types

t()

@type t() :: %Slackblocks.Blocks.Container{
  block_id: binary() | nil,
  child_blocks: [Slackblocks.Types.block()],
  default_collapsed: boolean() | nil,
  has_header_divider: boolean() | nil,
  icon: Slackblocks.Elements.Image.t() | nil,
  is_collapsible: boolean() | nil,
  rich_text_title: Slackblocks.Blocks.RichText.t() | nil,
  subtitle: Slackblocks.Types.text() | nil,
  title: Slackblocks.Objects.PlainText.t() | nil,
  width: Slackblocks.Types.container_width() | nil
}

Functions

change(value, options)

@spec change(
  t(),
  keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}

Atomically replaces supplied fields; omitted fields retain their values.

change!(value, options)

@spec change!(
  t(),
  keyword()
) :: t()

Replaces fields or raises Slackblocks.ValidationError.

new(options)

@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}

Constructs and validates a value. Text conveniences apply to keyword input.

new!(options)

@spec new!(keyword()) :: t()

Constructs a value or raises Slackblocks.ValidationError.