class Slack::BlockKit::Element::Timepicker

An element which allows selection of a time of day.

On desktop clients, this time picker will take the form of a dropdown list with free-text entry for precise choices. On mobile clients, the time picker will use native time picker UIs.

api.slack.com/reference/block-kit/block-elements#timepicker

Constants

TYPE

Public Class Methods

new(action_id:) { |self| ... } click to toggle source
# File lib/slack/block_kit/element/timepicker.rb, line 18
def initialize(action_id:)
  @placeholder, @initial_time = nil
  @action_id = action_id

  yield(self) if block_given?
end

Public Instance Methods

as_json(*) click to toggle source
# File lib/slack/block_kit/element/timepicker.rb, line 37
def as_json(*)
  {
    type: TYPE,
    action_id: @action_id,
    placeholder: @placeholder&.as_json,
    initial_time: @initial_time,
    confirm: confirm&.as_json
  }.compact
end
initial_time(time_str) click to toggle source
# File lib/slack/block_kit/element/timepicker.rb, line 31
def initial_time(time_str)
  @initial_time = time_str

  self
end
placeholder(text:, emoji: nil) click to toggle source
# File lib/slack/block_kit/element/timepicker.rb, line 25
def placeholder(text:, emoji: nil)
  @placeholder = Composition::PlainText.new(text: text, emoji: emoji)

  self
end