class Slack::BlockKit::Element::OverflowMenu

This is like a cross between a button and a select menu - when a user clicks on this overflow button, they will be presented with a list of options to choose from. Unlike the select menu, there is no typeahead field, and the button always appears with an ellipsis (“…”) rather than customisable text.

As such, it is usually used if you want a more compact layout than a select menu, or to supply a list of less visually important actions after a row of buttons.

api.slack.com/reference/messaging/block-elements#overflow

Constants

TYPE

Attributes

confirm[RW]
options[RW]

Public Class Methods

new(action_id:) { |self| ... } click to toggle source
# File lib/slack/block_kit/element/overflow_menu.rb, line 22
def initialize(action_id:)
  @action_id = action_id
  @options = []

  yield(self) if block_given?
end

Public Instance Methods

as_json(*) click to toggle source
# File lib/slack/block_kit/element/overflow_menu.rb, line 47
def as_json(*)
  {
    type: TYPE,
    action_id: @action_id,
    options: @options.map(&:as_json),
    confirm: @confirm&.as_json
  }.compact
end
confirmation_dialog() { |confirm| ... } click to toggle source
# File lib/slack/block_kit/element/overflow_menu.rb, line 39
def confirmation_dialog
  @confirm = Composition::ConfirmationDialog.new

  yield(@confirm) if block_given?

  self
end
option(value:, text:, emoji: nil) click to toggle source
# File lib/slack/block_kit/element/overflow_menu.rb, line 29
def option(value:, text:, emoji: nil)
  @options << Composition::Option.new(
    value: value,
    text: text,
    emoji: emoji
  )

  self
end