Slackblocks.Views.Modal (slackblocks v2.8.0)

View Source

The view payload for views.open, views.push, and views.update.

Slack reference: https://docs.slack.dev/surfaces/modals

Fields

  • title — Sets the title in the modal's top bar. Required.
  • blocks — Adds the blocks shown in the modal, in display order. Required.
  • close — Sets the label of the button that closes the modal. Optional; nil omits the field.
  • submit — Sets the label of the button that submits the modal. Optional; nil omits the field.
  • private_metadata — Sets application-defined data returned in view payloads. Optional; nil omits the field.
  • callback_id — Sets an identifier returned in view payloads so your app can recognize the view. Optional; nil omits the field.
  • clear_on_close — Sets whether closing this modal closes every view in its stack. Optional; nil omits the field.
  • notify_on_close — Sets whether Slack sends a view_closed event when the user closes the modal. Optional; nil omits the field.
  • external_id — Sets a workspace-unique identifier you can use to update the view later. Optional; nil omits the field.
  • submit_disabled — Sets whether the submit button starts disabled. Only valid in workflow configuration modals. 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.Views.Modal{
  blocks: [Slackblocks.Types.block()],
  callback_id: binary() | nil,
  clear_on_close: boolean() | nil,
  close: Slackblocks.Objects.PlainText.t() | nil,
  external_id: binary() | nil,
  notify_on_close: boolean() | nil,
  private_metadata: binary() | nil,
  submit: Slackblocks.Objects.PlainText.t() | nil,
  submit_disabled: boolean() | nil,
  title: Slackblocks.Objects.PlainText.t()
}

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.