Class: Slack::BlockKit::Element::UrlTextInput
- Inherits:
-
Object
- Object
- Slack::BlockKit::Element::UrlTextInput
- Defined in:
- lib/slack/block_kit/element/url_text_input.rb
Overview
A URL input element, similar to the Plain-text input element, creates a single line field where a user can enter a URL. It can appear as a single-line field.
URL-text input elements are currently only available in modals
Constant Summary collapse
- TYPE =
'url_text_input'
Instance Method Summary collapse
- #as_json ⇒ Object
- #dispatch_action_config(triggers: nil) {|@dispatch_action_config| ... } ⇒ Object
-
#initialize(action_id:, placeholder: nil, initial_value: nil, focus_on_load: nil) ⇒ UrlTextInput
constructor
A new instance of UrlTextInput.
Constructor Details
#initialize(action_id:, placeholder: nil, initial_value: nil, focus_on_load: nil) ⇒ UrlTextInput
Returns a new instance of UrlTextInput.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/slack/block_kit/element/url_text_input.rb', line 15 def initialize( action_id:, placeholder: nil, initial_value: nil, focus_on_load: nil ) @placeholder = placeholder && Composition::PlainText.new(text: placeholder) @initial_value = initial_value @action_id = action_id @focus_on_load = focus_on_load @dispatch_action_config = nil end |
Instance Method Details
#as_json ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/slack/block_kit/element/url_text_input.rb', line 36 def as_json(*) { type: TYPE, action_id: @action_id, placeholder: @placeholder&.as_json, initial_value: @initial_value, focus_on_load: @focus_on_load, dispatch_action_config: @dispatch_action_config&.as_json }.compact end |
#dispatch_action_config(triggers: nil) {|@dispatch_action_config| ... } ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/slack/block_kit/element/url_text_input.rb', line 28 def dispatch_action_config(triggers: nil) @dispatch_action_config = Composition::DispatchActionConfiguration.new(triggers: triggers) yield(@dispatch_action_config) if block_given? self end |