class Slack::BlockKit::Element::DatePicker
An element which lets users easily select a date from a calendar style UI.
Date picker elements can be used inside of section and actions blocks.
Constants
- TYPE
Public Class Methods
new(action_id:, placeholder: nil, initial: nil, emoji: nil) { |self| ... }
click to toggle source
# File lib/slack/block_kit/element/date_picker.rb, line 17 def initialize(action_id:, placeholder: nil, initial: nil, emoji: nil) @action_id = action_id @initial_date = initial @placeholder = placeholder_text(placeholder, emoji) yield(self) if block_given? end
Public Instance Methods
as_json(*)
click to toggle source
# File lib/slack/block_kit/element/date_picker.rb, line 25 def as_json(*) { type: TYPE, action_id: @action_id, placeholder: @placeholder&.as_json, initial_date: @initial_date, confirm: confirm&.as_json }.compact end
Private Instance Methods
placeholder_text(text, emoji)
click to toggle source
# File lib/slack/block_kit/element/date_picker.rb, line 37 def placeholder_text(text, emoji) return unless text Composition::PlainText.new(text: text, emoji: emoji) end