Slackblocks.Blocks.Card (slackblocks v2.8.0)

View Source

A compact card with an image, text, and up to three buttons.

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

Fields

  • hero_image — Sets the image displayed prominently at the top of the card. Optional; nil omits the field.
  • icon — Sets the image displayed beside the title. Optional; nil omits the field.
  • title — Sets the card title. Optional; nil omits the field.
  • subtitle — Sets the supporting text shown below the title. Optional; nil omits the field.
  • body — Sets the main body text of the card. Optional; nil omits the field.
  • actions — Adds buttons displayed at the bottom of the card, in display order. Optional; nil omits the field.
  • slack_icon — Sets a Slack-provided icon displayed beside the title. Cannot be combined with an image icon. Optional; nil omits the field.
  • subtext — Sets the small print shown at the bottom of the card. 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.Card{
  actions: [Slackblocks.Elements.Button.t()] | nil,
  block_id: binary() | nil,
  body: Slackblocks.Types.text() | nil,
  hero_image: Slackblocks.Elements.Image.t() | nil,
  icon: Slackblocks.Elements.Image.t() | nil,
  slack_icon: Slackblocks.Objects.SlackIcon.t() | nil,
  subtext: Slackblocks.Types.text() | nil,
  subtitle: Slackblocks.Types.text() | nil,
  title: Slackblocks.Types.text() | 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.