Elements
This page documents the public Java API for elements, generated from the Javadoc by the javadoc tool. Values are immutable, builders are concrete and fluent, validation runs when you call .build(), and typed getters read built values back.
ButtonElement
An interactive button that sends a payload or opens a URL.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
text,actionId.
See the Slack reference.
Builder — no arguments
Starts a new builder.
public static ButtonElement.Builder builder()
Returns: a new builder
Related types: ButtonElement
Builder — String, String
Starts a button builder with its required label and action identifier.
public static ButtonElement.Builder builder(String text, String actionId)
| Parameter | Description |
|---|---|
text | button label |
actionId | identifier returned in interaction payloads |
Returns: a new builder
Related types: ButtonElement
GetText
Returns the button label.
public PlainText getText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetUrl
Returns a URL opened in the user's browser when the button is clicked. Slack still sends an interaction payload.
public Optional<String> getUrl()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetValue
Returns the application-defined value sent in interaction payloads.
public Optional<String> getValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetStyle
Returns the button's emphasis. Omit it for the default neutral style.
public Optional<ButtonStyle> getStyle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ButtonStyle
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetAccessibilityLabel
Returns the label read by screen readers in place of the visible text.
public Optional<String> getAccessibilityLabel()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Text — String
Sets the button label.
Required. Slack allows at most 75 characters. The string is sent as a plain_text text object.
public ButtonElement.Builder text(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ButtonElement
Text — PlainText
Sets the button label.
Required. Slack allows at most 75 characters.
public ButtonElement.Builder text(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ButtonElement, PlainText
PlainText
Sets the button label.
Required. Slack allows at most 75 characters. Equivalent to text(String).
public ButtonElement.Builder plainText(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ButtonElement
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ButtonElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ButtonElement
Url
Sets a URL opened in the user's browser when the button is clicked. Slack still sends an interaction payload.
Slack allows at most 3000 characters.
public ButtonElement.Builder url(String value)
| Parameter | Description |
|---|---|
value | value for Slack's url field |
Returns: this builder
Related types: ButtonElement
Value
Sets the application-defined value sent in interaction payloads.
Slack allows at most 2000 characters.
public ButtonElement.Builder value(String value)
| Parameter | Description |
|---|---|
value | value for Slack's value field |
Returns: this builder
Related types: ButtonElement
Style
Sets the button's emphasis. Omit it for the default neutral style.
public ButtonElement.Builder style(ButtonStyle value)
| Parameter | Description |
|---|---|
value | value for Slack's style field |
Returns: this builder
Related types: ButtonElement, ButtonStyle
Confirm
Sets a confirmation dialog shown before the action is sent.
public ButtonElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: ButtonElement, Confirmation
AccessibilityLabel
Sets the label read by screen readers in place of the visible text.
Slack allows at most 75 characters.
public ButtonElement.Builder accessibilityLabel(String value)
| Parameter | Description |
|---|---|
value | value for Slack's accessibility_label field |
Returns: this builder
Related types: ButtonElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ButtonElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ButtonElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ButtonElement build()
Returns: an immutable ButtonElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ButtonElement
ButtonStyle
Visual emphasis for buttons and confirmation dialogs.
| Constant | Slack value | Meaning |
|---|---|---|
PRIMARY | primary | Green emphasis for the affirmative action. |
DANGER | danger | Red emphasis for destructive actions. |
WireValue
Returns the value Slack expects in JSON.
public String wireValue()
Returns: the wire value
FromWireValue
Finds the constant for a Slack JSON value.
public static Optional<ButtonStyle> fromWireValue(String wireValue)
| Parameter | Description |
|---|---|
wireValue | the value Slack uses in JSON |
Returns: the matching constant, or an empty optional for an unknown value
Related types: ButtonStyle
ChannelMultiSelectElement
A menu for selecting multiple public channels.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static ChannelMultiSelectElement.Builder builder()
Returns: a new builder
Related types: ChannelMultiSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialChannels
Returns channel IDs that are selected when the menu loads.
public List<String> getInitialChannels()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetMaxSelectedItems
Returns the maximum number of items a user can select.
public OptionalInt getMaxSelectedItems()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ChannelMultiSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ChannelMultiSelectElement
InitialChannels
Adds channel IDs that are selected when the menu loads.
Each call appends to any values already added.
public ChannelMultiSelectElement.Builder initialChannels(String... values)
| Parameter | Description |
|---|---|
values | values appended in order |
Returns: this builder
Related types: ChannelMultiSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public ChannelMultiSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: ChannelMultiSelectElement, Confirmation
MaxSelectedItems
Sets the maximum number of items a user can select.
public ChannelMultiSelectElement.Builder maxSelectedItems(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_selected_items field |
Returns: this builder
Related types: ChannelMultiSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public ChannelMultiSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: ChannelMultiSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ChannelMultiSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ChannelMultiSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public ChannelMultiSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ChannelMultiSelectElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ChannelMultiSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ChannelMultiSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ChannelMultiSelectElement build()
Returns: an immutable ChannelMultiSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ChannelMultiSelectElement
ChannelSelectElement
A menu for selecting one public channel.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static ChannelSelectElement.Builder builder()
Returns: a new builder
Related types: ChannelSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialChannel
Returns the channel ID selected when the menu loads.
public Optional<String> getInitialChannel()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetResponseUrlEnabled
Returns whether the selected conversation receives a response URL in the view submission payload. Only valid in modals.
public Optional<Boolean> getResponseUrlEnabled()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ChannelSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ChannelSelectElement
InitialChannel
Sets the channel ID selected when the menu loads.
public ChannelSelectElement.Builder initialChannel(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_channel field |
Returns: this builder
Related types: ChannelSelectElement
ResponseUrlEnabled
Sets whether the selected conversation receives a response URL in the view submission payload. Only valid in modals.
public ChannelSelectElement.Builder responseUrlEnabled(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's response_url_enabled field |
Returns: this builder
Related types: ChannelSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public ChannelSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: ChannelSelectElement, Confirmation
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public ChannelSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: ChannelSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ChannelSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ChannelSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public ChannelSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ChannelSelectElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ChannelSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ChannelSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ChannelSelectElement build()
Returns: an immutable ChannelSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ChannelSelectElement
CheckboxesElement
A group of checkboxes.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId,options.
See the Slack reference.
Builder
Starts a new builder.
public static CheckboxesElement.Builder builder()
Returns: a new builder
Related types: CheckboxesElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetOptions
Returns selectable options in display order.
public List<Option> getOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetInitialOptions
Returns options that are selected when the element loads. Each must match an option in the element.
public List<Option> getInitialOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public CheckboxesElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: CheckboxesElement
Options
Adds selectable options in display order.
Required. Must contain between 1 and 10 items. Each call appends to any values already added.
public CheckboxesElement.Builder options(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: CheckboxesElement, Option
InitialOptions
Adds options that are selected when the element loads. Each must match an option in the element.
Each call appends to any values already added.
public CheckboxesElement.Builder initialOptions(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: CheckboxesElement, Option
Confirm
Sets a confirmation dialog shown before the action is sent.
public CheckboxesElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: CheckboxesElement, Confirmation
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public CheckboxesElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: CheckboxesElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public CheckboxesElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: CheckboxesElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public CheckboxesElement build()
Returns: an immutable CheckboxesElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: CheckboxesElement
ConversationMultiSelectElement
A menu for selecting multiple conversations.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static ConversationMultiSelectElement.Builder builder()
Returns: a new builder
Related types: ConversationMultiSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialConversations
Returns conversation IDs that are selected when the menu loads.
public List<String> getInitialConversations()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDefaultToCurrentConversation
Returns whether the menu pre-selects the conversation the user is viewing.
public Optional<Boolean> getDefaultToCurrentConversation()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFilter
Returns which conversation types the menu offers.
public Optional<ConversationFilter> getFilter()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ConversationFilter
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetMaxSelectedItems
Returns the maximum number of items a user can select.
public OptionalInt getMaxSelectedItems()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ConversationMultiSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ConversationMultiSelectElement
InitialConversations
Adds conversation IDs that are selected when the menu loads.
Each call appends to any values already added.
public ConversationMultiSelectElement.Builder initialConversations(String... values)
| Parameter | Description |
|---|---|
values | values appended in order |
Returns: this builder
Related types: ConversationMultiSelectElement
DefaultToCurrentConversation
Sets whether the menu pre-selects the conversation the user is viewing.
public ConversationMultiSelectElement.Builder defaultToCurrentConversation(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's default_to_current_conversation field |
Returns: this builder
Related types: ConversationMultiSelectElement
Filter
Sets which conversation types the menu offers.
public ConversationMultiSelectElement.Builder filter(ConversationFilter value)
| Parameter | Description |
|---|---|
value | nested ConversationFilter |
Returns: this builder
Related types: ConversationFilter, ConversationMultiSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public ConversationMultiSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, ConversationMultiSelectElement
MaxSelectedItems
Sets the maximum number of items a user can select.
public ConversationMultiSelectElement.Builder maxSelectedItems(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_selected_items field |
Returns: this builder
Related types: ConversationMultiSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public ConversationMultiSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: ConversationMultiSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ConversationMultiSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ConversationMultiSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public ConversationMultiSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ConversationMultiSelectElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ConversationMultiSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ConversationMultiSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ConversationMultiSelectElement build()
Returns: an immutable ConversationMultiSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ConversationMultiSelectElement
ConversationSelectElement
A menu for selecting one conversation.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static ConversationSelectElement.Builder builder()
Returns: a new builder
Related types: ConversationSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialConversation
Returns the conversation ID selected when the menu loads.
public Optional<String> getInitialConversation()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDefaultToCurrentConversation
Returns whether the menu pre-selects the conversation the user is viewing.
public Optional<Boolean> getDefaultToCurrentConversation()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFilter
Returns which conversation types the menu offers.
public Optional<ConversationFilter> getFilter()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ConversationFilter
GetResponseUrlEnabled
Returns whether the selected conversation receives a response URL in the view submission payload. Only valid in modals.
public Optional<Boolean> getResponseUrlEnabled()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ConversationSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ConversationSelectElement
InitialConversation
Sets the conversation ID selected when the menu loads.
public ConversationSelectElement.Builder initialConversation(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_conversation field |
Returns: this builder
Related types: ConversationSelectElement
DefaultToCurrentConversation
Sets whether the menu pre-selects the conversation the user is viewing.
public ConversationSelectElement.Builder defaultToCurrentConversation(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's default_to_current_conversation field |
Returns: this builder
Related types: ConversationSelectElement
Filter
Sets which conversation types the menu offers.
public ConversationSelectElement.Builder filter(ConversationFilter value)
| Parameter | Description |
|---|---|
value | nested ConversationFilter |
Returns: this builder
Related types: ConversationFilter, ConversationSelectElement
ResponseUrlEnabled
Sets whether the selected conversation receives a response URL in the view submission payload. Only valid in modals.
public ConversationSelectElement.Builder responseUrlEnabled(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's response_url_enabled field |
Returns: this builder
Related types: ConversationSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public ConversationSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, ConversationSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public ConversationSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: ConversationSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ConversationSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ConversationSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public ConversationSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ConversationSelectElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ConversationSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ConversationSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ConversationSelectElement build()
Returns: an immutable ConversationSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ConversationSelectElement
DatePickerElement
A calendar date picker.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static DatePickerElement.Builder builder()
Returns: a new builder
Related types: DatePickerElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialDate
Returns the initially selected date, formatted as YYYY-MM-DD.
public Optional<String> getInitialDate()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public DatePickerElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: DatePickerElement
InitialDate
Sets the initially selected date, formatted as YYYY-MM-DD.
public DatePickerElement.Builder initialDate(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_date field |
Returns: this builder
Related types: DatePickerElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public DatePickerElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, DatePickerElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public DatePickerElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: DatePickerElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public DatePickerElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: DatePickerElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public DatePickerElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: DatePickerElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public DatePickerElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: DatePickerElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public DatePickerElement build()
Returns: an immutable DatePickerElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: DatePickerElement
DateTimePickerElement
A combined date and time picker.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static DateTimePickerElement.Builder builder()
Returns: a new builder
Related types: DateTimePickerElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialDateTime
Returns the initially selected moment as a UNIX timestamp in seconds.
public OptionalLong getInitialDateTime()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public DateTimePickerElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: DateTimePickerElement
InitialDateTime
Sets the initially selected moment as a UNIX timestamp in seconds.
public DateTimePickerElement.Builder initialDateTime(long value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_date_time field |
Returns: this builder
Related types: DateTimePickerElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public DateTimePickerElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, DateTimePickerElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public DateTimePickerElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: DateTimePickerElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public DateTimePickerElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: DateTimePickerElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public DateTimePickerElement build()
Returns: an immutable DateTimePickerElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: DateTimePickerElement
Element
A validated interactive, visual, or input element nested inside a Slack block.
Implemented by ButtonElement, ChannelMultiSelectElement, ChannelSelectElement, CheckboxesElement, ConversationMultiSelectElement, ConversationSelectElement, DatePickerElement, DateTimePickerElement, EmailInputElement, ExternalMultiSelectElement, ExternalSelectElement, FeedbackButtonsElement, FileInputElement, IconButtonElement, ImageElement, NumberInputElement, OverflowElement, PlainTextInputElement, RadioButtonsElement, RichTextInputElement, StaticMultiSelectElement, StaticSelectElement, TimePickerElement, UrlInputElement, UserMultiSelectElement, UserSelectElement, WorkflowButtonElement.
EmailInputElement
A single-line input that accepts an email address.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static EmailInputElement.Builder builder()
Returns: a new builder
Related types: EmailInputElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialValue
Returns the value present when the input loads.
public Optional<String> getInitialValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDispatchActionConfig
Returns which user interactions send a block_actions payload.
public Optional<DispatchActionConfiguration> getDispatchActionConfig()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: DispatchActionConfiguration
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public EmailInputElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: EmailInputElement
InitialValue
Sets the value present when the input loads.
public EmailInputElement.Builder initialValue(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_value field |
Returns: this builder
Related types: EmailInputElement
DispatchActionConfig
Sets which user interactions send a block_actions payload.
public EmailInputElement.Builder dispatchActionConfig(DispatchActionConfiguration value)
| Parameter | Description |
|---|---|
value | nested DispatchActionConfiguration |
Returns: this builder
Related types: DispatchActionConfiguration, EmailInputElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public EmailInputElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: EmailInputElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public EmailInputElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: EmailInputElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public EmailInputElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: EmailInputElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public EmailInputElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: EmailInputElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public EmailInputElement build()
Returns: an immutable EmailInputElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: EmailInputElement
ExternalMultiSelectElement
A menu for selecting multiple options loaded from your app.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static ExternalMultiSelectElement.Builder builder()
Returns: a new builder
Related types: ExternalMultiSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMinQueryLength
Returns how many characters the user must type before Slack queries your options endpoint.
public OptionalInt getMinQueryLength()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialOptions
Returns options that are selected when the element loads. Each must match an option in the element.
public List<Option> getInitialOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetMaxSelectedItems
Returns the maximum number of items a user can select.
public OptionalInt getMaxSelectedItems()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ExternalMultiSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ExternalMultiSelectElement
MinQueryLength
Sets how many characters the user must type before Slack queries your options endpoint.
public ExternalMultiSelectElement.Builder minQueryLength(int value)
| Parameter | Description |
|---|---|
value | value for Slack's min_query_length field |
Returns: this builder
Related types: ExternalMultiSelectElement
InitialOptions
Adds options that are selected when the element loads. Each must match an option in the element.
Each call appends to any values already added.
public ExternalMultiSelectElement.Builder initialOptions(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: ExternalMultiSelectElement, Option
Confirm
Sets a confirmation dialog shown before the action is sent.
public ExternalMultiSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, ExternalMultiSelectElement
MaxSelectedItems
Sets the maximum number of items a user can select.
public ExternalMultiSelectElement.Builder maxSelectedItems(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_selected_items field |
Returns: this builder
Related types: ExternalMultiSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public ExternalMultiSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: ExternalMultiSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ExternalMultiSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ExternalMultiSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public ExternalMultiSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ExternalMultiSelectElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ExternalMultiSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ExternalMultiSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ExternalMultiSelectElement build()
Returns: an immutable ExternalMultiSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ExternalMultiSelectElement
ExternalSelectElement
A menu for selecting one option loaded from your app.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static ExternalSelectElement.Builder builder()
Returns: a new builder
Related types: ExternalSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMinQueryLength
Returns how many characters the user must type before Slack queries your options endpoint.
public OptionalInt getMinQueryLength()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialOption
Returns the option selected when the element loads. It must match an option in the element.
public Optional<Option> getInitialOption()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public ExternalSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: ExternalSelectElement
MinQueryLength
Sets how many characters the user must type before Slack queries your options endpoint.
public ExternalSelectElement.Builder minQueryLength(int value)
| Parameter | Description |
|---|---|
value | value for Slack's min_query_length field |
Returns: this builder
Related types: ExternalSelectElement
InitialOption
Sets the option selected when the element loads. It must match an option in the element.
public ExternalSelectElement.Builder initialOption(Option value)
| Parameter | Description |
|---|---|
value | nested Option |
Returns: this builder
Related types: ExternalSelectElement, Option
Confirm
Sets a confirmation dialog shown before the action is sent.
public ExternalSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, ExternalSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public ExternalSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: ExternalSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ExternalSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ExternalSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public ExternalSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ExternalSelectElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ExternalSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ExternalSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ExternalSelectElement build()
Returns: an immutable ExternalSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ExternalSelectElement
FeedbackButtonsElement
A pair of thumbs-up and thumbs-down feedback buttons.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
positiveButton,negativeButton.
See the Slack reference.
Builder
Starts a new builder.
public static FeedbackButtonsElement.Builder builder()
Returns: a new builder
Related types: FeedbackButtonsElement
GetPositiveButton
Returns the button for positive feedback.
public FeedbackButton getPositiveButton()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: FeedbackButton
GetNegativeButton
Returns the button for negative feedback.
public FeedbackButton getNegativeButton()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: FeedbackButton
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public Optional<String> getActionId()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
PositiveButton
Sets the button for positive feedback.
Required.
public FeedbackButtonsElement.Builder positiveButton(FeedbackButton value)
| Parameter | Description |
|---|---|
value | nested FeedbackButton |
Returns: this builder
Related types: FeedbackButton, FeedbackButtonsElement
NegativeButton
Sets the button for negative feedback.
Required.
public FeedbackButtonsElement.Builder negativeButton(FeedbackButton value)
| Parameter | Description |
|---|---|
value | nested FeedbackButton |
Returns: this builder
Related types: FeedbackButton, FeedbackButtonsElement
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Slack allows at most 255 characters.
public FeedbackButtonsElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: FeedbackButtonsElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public FeedbackButtonsElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: FeedbackButtonsElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public FeedbackButtonsElement build()
Returns: an immutable FeedbackButtonsElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: FeedbackButtonsElement
FileInputElement
An input that lets users upload files.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static FileInputElement.Builder builder()
Returns: a new builder
Related types: FileInputElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFiletypes
Returns accepted file extensions, such as pdf or png.
public List<String> getFiletypes()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMaxFiles
Returns the maximum number of files a user can upload.
public OptionalInt getMaxFiles()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public FileInputElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: FileInputElement
Filetypes
Adds accepted file extensions, such as pdf or png.
Each call appends to any values already added.
public FileInputElement.Builder filetypes(String... values)
| Parameter | Description |
|---|---|
values | values appended in order |
Returns: this builder
Related types: FileInputElement
MaxFiles
Sets the maximum number of files a user can upload.
Must be between 1 and 10.
public FileInputElement.Builder maxFiles(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_files field |
Returns: this builder
Related types: FileInputElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public FileInputElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: FileInputElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public FileInputElement build()
Returns: an immutable FileInputElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: FileInputElement
IconButtonElement
A button that shows an icon instead of text.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
text.
See the Slack reference.
Builder
Starts a new builder.
public static IconButtonElement.Builder builder()
Returns: a new builder
Related types: IconButtonElement
GetText
Returns the text used as the button's accessible name.
public PlainText getText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetIcon
Returns the icon shown on the button.
public Optional<IconButtonIcon> getIcon()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: IconButtonIcon
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public Optional<String> getActionId()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetValue
Returns the application-defined value sent in interaction payloads.
public Optional<String> getValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetAccessibilityLabel
Returns the label read by screen readers in place of the visible text.
public Optional<String> getAccessibilityLabel()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetVisibleToUserIds
Returns the IDs of users who can see this button.
public List<String> getVisibleToUserIds()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Text — String
Sets the text used as the button's accessible name.
Required. The string is sent as a plain_text text object.
public IconButtonElement.Builder text(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: IconButtonElement
Text — PlainText
Sets the text used as the button's accessible name.
Required.
public IconButtonElement.Builder text(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: IconButtonElement, PlainText
PlainText
Sets the text used as the button's accessible name.
Required. Equivalent to text(String).
public IconButtonElement.Builder plainText(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: IconButtonElement
Icon
Sets the icon shown on the button.
public IconButtonElement.Builder icon(IconButtonIcon value)
| Parameter | Description |
|---|---|
value | value for Slack's icon field |
Returns: this builder
Related types: IconButtonElement, IconButtonIcon
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Slack allows at most 255 characters.
public IconButtonElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: IconButtonElement
Value
Sets the application-defined value sent in interaction payloads.
public IconButtonElement.Builder value(String value)
| Parameter | Description |
|---|---|
value | value for Slack's value field |
Returns: this builder
Related types: IconButtonElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public IconButtonElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, IconButtonElement
AccessibilityLabel
Sets the label read by screen readers in place of the visible text.
public IconButtonElement.Builder accessibilityLabel(String value)
| Parameter | Description |
|---|---|
value | value for Slack's accessibility_label field |
Returns: this builder
Related types: IconButtonElement
VisibleToUserIds
Adds the IDs of users who can see this button.
Slack allows at most 10 items. Each call appends to any values already added.
public IconButtonElement.Builder visibleToUserIds(String... values)
| Parameter | Description |
|---|---|
values | values appended in order |
Returns: this builder
Related types: IconButtonElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public IconButtonElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: IconButtonElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public IconButtonElement build()
Returns: an immutable IconButtonElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: IconButtonElement
IconButtonIcon
Icons supported by icon buttons.
| Constant | Slack value | Meaning |
|---|---|---|
TRASH | trash | A trash can, for delete actions. |
WireValue
Returns the value Slack expects in JSON.
public String wireValue()
Returns: the wire value
FromWireValue
Finds the constant for a Slack JSON value.
public static Optional<IconButtonIcon> fromWireValue(String wireValue)
| Parameter | Description |
|---|---|
wireValue | the value Slack uses in JSON |
Returns: the matching constant, or an empty optional for an unknown value
Related types: IconButtonIcon
ImageElement
An image displayed inside a section, context, or card.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
altText. -
Provide exactly one of an image URL or a Slack file.
See the Slack reference.
Builder
Starts a new builder.
public static ImageElement.Builder builder()
Returns: a new builder
Related types: ImageElement
GetAltText
Returns a plain-text summary of the image or video for assistive technology.
public String getAltText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetImageUrl
Returns the publicly accessible URL of the image. Cannot be combined with a Slack file.
public Optional<String> getImageUrl()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetSlackFile
Returns a file hosted in Slack as the image source. Cannot be combined with an image URL.
public Optional<SlackFile> getSlackFile()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: SlackFile
AltText
Sets a plain-text summary of the image or video for assistive technology.
Required.
public ImageElement.Builder altText(String value)
| Parameter | Description |
|---|---|
value | value for Slack's alt_text field |
Returns: this builder
Related types: ImageElement
ImageUrl
Sets the publicly accessible URL of the image. Cannot be combined with a Slack file.
public ImageElement.Builder imageUrl(String value)
| Parameter | Description |
|---|---|
value | value for Slack's image_url field |
Returns: this builder
Related types: ImageElement
SlackFile
Sets a file hosted in Slack as the image source. Cannot be combined with an image URL.
public ImageElement.Builder slackFile(SlackFile value)
| Parameter | Description |
|---|---|
value | nested SlackFile |
Returns: this builder
Related types: ImageElement, SlackFile
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public ImageElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ImageElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ImageElement build()
Returns: an immutable ImageElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ImageElement
InputElement
An element that can be placed in an input block.
Implemented by ChannelMultiSelectElement, ChannelSelectElement, CheckboxesElement, ConversationMultiSelectElement, ConversationSelectElement, DatePickerElement, DateTimePickerElement, EmailInputElement, ExternalMultiSelectElement, ExternalSelectElement, FileInputElement, NumberInputElement, PlainTextInputElement, RadioButtonsElement, RichTextInputElement, StaticMultiSelectElement, StaticSelectElement, TimePickerElement, UrlInputElement, UserMultiSelectElement, UserSelectElement.
NumberInputElement
An input that accepts whole or decimal numbers.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
actionId. -
The minimum value cannot exceed the maximum value.
See the Slack reference.
Builder
Starts a new builder.
public static NumberInputElement.Builder builder()
Returns: a new builder
Related types: NumberInputElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDecimalAllowed
Returns whether the input accepts decimal numbers.
public Optional<Boolean> getDecimalAllowed()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialValue
Returns the number present when the input loads, as a string such as 42 or 3.5.
public Optional<String> getInitialValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMinValue
Returns the smallest accepted number.
public OptionalDouble getMinValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMaxValue
Returns the largest accepted number.
public OptionalDouble getMaxValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDispatchActionConfig
Returns which user interactions send a block_actions payload.
public Optional<DispatchActionConfiguration> getDispatchActionConfig()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: DispatchActionConfiguration
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public NumberInputElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: NumberInputElement
IsDecimalAllowed
Sets whether the input accepts decimal numbers.
public NumberInputElement.Builder isDecimalAllowed(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's is_decimal_allowed field |
Returns: this builder
Related types: NumberInputElement
InitialValue
Sets the number present when the input loads, as a string such as 42 or 3.5.
public NumberInputElement.Builder initialValue(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_value field |
Returns: this builder
Related types: NumberInputElement
MinValue
Sets the smallest accepted number.
public NumberInputElement.Builder minValue(double value)
| Parameter | Description |
|---|---|
value | value for Slack's min_value field |
Returns: this builder
Related types: NumberInputElement
MaxValue
Sets the largest accepted number.
public NumberInputElement.Builder maxValue(double value)
| Parameter | Description |
|---|---|
value | value for Slack's max_value field |
Returns: this builder
Related types: NumberInputElement
DispatchActionConfig
Sets which user interactions send a block_actions payload.
public NumberInputElement.Builder dispatchActionConfig(DispatchActionConfiguration value)
| Parameter | Description |
|---|---|
value | nested DispatchActionConfiguration |
Returns: this builder
Related types: DispatchActionConfiguration, NumberInputElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public NumberInputElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: NumberInputElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public NumberInputElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: NumberInputElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public NumberInputElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: NumberInputElement, PlainText
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public NumberInputElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: NumberInputElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public NumberInputElement build()
Returns: an immutable NumberInputElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: NumberInputElement
OverflowElement
A compact menu of up to five options.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId,options.
See the Slack reference.
Builder
Starts a new builder.
public static OverflowElement.Builder builder()
Returns: a new builder
Related types: OverflowElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetOptions
Returns selectable options in display order.
public List<Option> getOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public OverflowElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: OverflowElement
Options
Adds selectable options in display order.
Required. Must contain between 1 and 5 items. Each call appends to any values already added.
public OverflowElement.Builder options(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: Option, OverflowElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public OverflowElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, OverflowElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public OverflowElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: OverflowElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public OverflowElement build()
Returns: an immutable OverflowElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: OverflowElement
PlainTextInputElement
A single-line or multi-line free-text input.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static PlainTextInputElement.Builder builder()
Returns: a new builder
Related types: PlainTextInputElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialValue
Returns the value present when the input loads.
public Optional<String> getInitialValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMultiline
Returns whether the input is a multi-line text area.
public Optional<Boolean> getMultiline()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMinLength
Returns the minimum number of characters the user must enter.
public OptionalInt getMinLength()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMaxLength
Returns the maximum number of characters the user can enter.
public OptionalInt getMaxLength()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDispatchActionConfig
Returns which user interactions send a block_actions payload.
public Optional<DispatchActionConfiguration> getDispatchActionConfig()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: DispatchActionConfiguration
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public PlainTextInputElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: PlainTextInputElement
InitialValue
Sets the value present when the input loads.
public PlainTextInputElement.Builder initialValue(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_value field |
Returns: this builder
Related types: PlainTextInputElement
Multiline
Sets whether the input is a multi-line text area.
public PlainTextInputElement.Builder multiline(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's multiline field |
Returns: this builder
Related types: PlainTextInputElement
MinLength
Sets the minimum number of characters the user must enter.
public PlainTextInputElement.Builder minLength(int value)
| Parameter | Description |
|---|---|
value | value for Slack's min_length field |
Returns: this builder
Related types: PlainTextInputElement
MaxLength
Sets the maximum number of characters the user can enter.
Must be at most 3000.
public PlainTextInputElement.Builder maxLength(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_length field |
Returns: this builder
Related types: PlainTextInputElement
DispatchActionConfig
Sets which user interactions send a block_actions payload.
public PlainTextInputElement.Builder dispatchActionConfig(DispatchActionConfiguration value)
| Parameter | Description |
|---|---|
value | nested DispatchActionConfiguration |
Returns: this builder
Related types: DispatchActionConfiguration, PlainTextInputElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public PlainTextInputElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: PlainTextInputElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public PlainTextInputElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: PlainTextInputElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public PlainTextInputElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, PlainTextInputElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public PlainTextInputElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: PlainTextInputElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public PlainTextInputElement build()
Returns: an immutable PlainTextInputElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: PlainTextInputElement
RadioButtonsElement
A group of radio buttons.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId,options.
See the Slack reference.
Builder
Starts a new builder.
public static RadioButtonsElement.Builder builder()
Returns: a new builder
Related types: RadioButtonsElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetOptions
Returns selectable options in display order.
public List<Option> getOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetInitialOption
Returns the option selected when the element loads. It must match an option in the element.
public Optional<Option> getInitialOption()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public RadioButtonsElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: RadioButtonsElement
Options
Adds selectable options in display order.
Required. Must contain between 1 and 10 items. Each call appends to any values already added.
public RadioButtonsElement.Builder options(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: Option, RadioButtonsElement
InitialOption
Sets the option selected when the element loads. It must match an option in the element.
public RadioButtonsElement.Builder initialOption(Option value)
| Parameter | Description |
|---|---|
value | nested Option |
Returns: this builder
Related types: Option, RadioButtonsElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public RadioButtonsElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, RadioButtonsElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public RadioButtonsElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: RadioButtonsElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public RadioButtonsElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: RadioButtonsElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public RadioButtonsElement build()
Returns: an immutable RadioButtonsElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: RadioButtonsElement
RichTextInputElement
An input that accepts formatted rich text.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static RichTextInputElement.Builder builder()
Returns: a new builder
Related types: RichTextInputElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialValue
Returns the rich text present when the input loads.
public Optional<RichTextText> getInitialValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: RichTextText
GetDispatchActionConfig
Returns which user interactions send a block_actions payload.
public Optional<DispatchActionConfiguration> getDispatchActionConfig()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: DispatchActionConfiguration
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetMinLines
Returns the minimum visible height of the input, in lines.
public OptionalInt getMinLines()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetMaxLines
Returns the maximum visible height of the input, in lines.
public OptionalInt getMaxLines()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public RichTextInputElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: RichTextInputElement
InitialValue
Sets the rich text present when the input loads.
public RichTextInputElement.Builder initialValue(RichTextText value)
| Parameter | Description |
|---|---|
value | nested RichTextText |
Returns: this builder
Related types: RichTextInputElement, RichTextText
DispatchActionConfig
Sets which user interactions send a block_actions payload.
public RichTextInputElement.Builder dispatchActionConfig(DispatchActionConfiguration value)
| Parameter | Description |
|---|---|
value | nested DispatchActionConfiguration |
Returns: this builder
Related types: DispatchActionConfiguration, RichTextInputElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public RichTextInputElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: RichTextInputElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public RichTextInputElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: RichTextInputElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public RichTextInputElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, RichTextInputElement
MinLines
Sets the minimum visible height of the input, in lines.
public RichTextInputElement.Builder minLines(int value)
| Parameter | Description |
|---|---|
value | value for Slack's min_lines field |
Returns: this builder
Related types: RichTextInputElement
MaxLines
Sets the maximum visible height of the input, in lines.
public RichTextInputElement.Builder maxLines(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_lines field |
Returns: this builder
Related types: RichTextInputElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public RichTextInputElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: RichTextInputElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public RichTextInputElement build()
Returns: an immutable RichTextInputElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: RichTextInputElement
StaticMultiSelectElement
A menu for selecting multiple options defined in the payload.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
actionId. -
Use options or option groups, not both.
See the Slack reference.
Builder
Starts a new builder.
public static StaticMultiSelectElement.Builder builder()
Returns: a new builder
Related types: StaticMultiSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetOptions
Returns selectable options in display order.
public List<Option> getOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetOptionGroups
Returns labelled groups of options in display order. Cannot be combined with ungrouped options.
public List<OptionGroup> getOptionGroups()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: OptionGroup
GetInitialOptions
Returns options that are selected when the element loads. Each must match an option in the element.
public List<Option> getInitialOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetMaxSelectedItems
Returns the maximum number of items a user can select.
public OptionalInt getMaxSelectedItems()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public StaticMultiSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: StaticMultiSelectElement
Options
Adds selectable options in display order.
Slack allows at most 100 items. Each call appends to any values already added.
public StaticMultiSelectElement.Builder options(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: Option, StaticMultiSelectElement
OptionGroups
Adds labelled groups of options in display order. Cannot be combined with ungrouped options.
Slack allows at most 100 items. Each call appends to any values already added.
public StaticMultiSelectElement.Builder optionGroups(OptionGroup... values)
| Parameter | Description |
|---|---|
values | OptionGroup values appended in order |
Returns: this builder
Related types: OptionGroup, StaticMultiSelectElement
InitialOptions
Adds options that are selected when the element loads. Each must match an option in the element.
Each call appends to any values already added.
public StaticMultiSelectElement.Builder initialOptions(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: Option, StaticMultiSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public StaticMultiSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, StaticMultiSelectElement
MaxSelectedItems
Sets the maximum number of items a user can select.
public StaticMultiSelectElement.Builder maxSelectedItems(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_selected_items field |
Returns: this builder
Related types: StaticMultiSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public StaticMultiSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: StaticMultiSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public StaticMultiSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: StaticMultiSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public StaticMultiSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, StaticMultiSelectElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public StaticMultiSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: StaticMultiSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public StaticMultiSelectElement build()
Returns: an immutable StaticMultiSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: StaticMultiSelectElement
StaticSelectElement
A menu for selecting one option defined in the payload.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
actionId. -
Use options or option groups, not both.
See the Slack reference.
Builder
Starts a new builder.
public static StaticSelectElement.Builder builder()
Returns: a new builder
Related types: StaticSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetOptions
Returns selectable options in display order.
public List<Option> getOptions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetOptionGroups
Returns labelled groups of options in display order. Cannot be combined with ungrouped options.
public List<OptionGroup> getOptionGroups()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: OptionGroup
GetInitialOption
Returns the option selected when the element loads. It must match an option in the element.
public Optional<Option> getInitialOption()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Option
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public StaticSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: StaticSelectElement
Options
Adds selectable options in display order.
Slack allows at most 100 items. Each call appends to any values already added.
public StaticSelectElement.Builder options(Option... values)
| Parameter | Description |
|---|---|
values | Option values appended in order |
Returns: this builder
Related types: Option, StaticSelectElement
OptionGroups
Adds labelled groups of options in display order. Cannot be combined with ungrouped options.
Slack allows at most 100 items. Each call appends to any values already added.
public StaticSelectElement.Builder optionGroups(OptionGroup... values)
| Parameter | Description |
|---|---|
values | OptionGroup values appended in order |
Returns: this builder
Related types: OptionGroup, StaticSelectElement
InitialOption
Sets the option selected when the element loads. It must match an option in the element.
public StaticSelectElement.Builder initialOption(Option value)
| Parameter | Description |
|---|---|
value | nested Option |
Returns: this builder
Related types: Option, StaticSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public StaticSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, StaticSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public StaticSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: StaticSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public StaticSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: StaticSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public StaticSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, StaticSelectElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public StaticSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: StaticSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public StaticSelectElement build()
Returns: an immutable StaticSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: StaticSelectElement
TimePickerElement
A time-of-day picker.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static TimePickerElement.Builder builder()
Returns: a new builder
Related types: TimePickerElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialTime
Returns the initially selected time, formatted as HH:mm in 24-hour time.
public Optional<String> getInitialTime()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetTimezone
Returns the IANA time zone used to display the time, such as Australia/Brisbane.
public Optional<String> getTimezone()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public TimePickerElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: TimePickerElement
InitialTime
Sets the initially selected time, formatted as HH:mm in 24-hour time.
public TimePickerElement.Builder initialTime(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_time field |
Returns: this builder
Related types: TimePickerElement
Timezone
Sets the IANA time zone used to display the time, such as Australia/Brisbane.
public TimePickerElement.Builder timezone(String value)
| Parameter | Description |
|---|---|
value | value for Slack's timezone field |
Returns: this builder
Related types: TimePickerElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public TimePickerElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, TimePickerElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public TimePickerElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: TimePickerElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public TimePickerElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: TimePickerElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public TimePickerElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, TimePickerElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public TimePickerElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: TimePickerElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public TimePickerElement build()
Returns: an immutable TimePickerElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: TimePickerElement
UrlInputElement
A single-line input that accepts a URL.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static UrlInputElement.Builder builder()
Returns: a new builder
Related types: UrlInputElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialValue
Returns the value present when the input loads.
public Optional<String> getInitialValue()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDispatchActionConfig
Returns which user interactions send a block_actions payload.
public Optional<DispatchActionConfiguration> getDispatchActionConfig()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: DispatchActionConfiguration
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public UrlInputElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: UrlInputElement
InitialValue
Sets the value present when the input loads.
public UrlInputElement.Builder initialValue(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_value field |
Returns: this builder
Related types: UrlInputElement
DispatchActionConfig
Sets which user interactions send a block_actions payload.
public UrlInputElement.Builder dispatchActionConfig(DispatchActionConfiguration value)
| Parameter | Description |
|---|---|
value | nested DispatchActionConfiguration |
Returns: this builder
Related types: DispatchActionConfiguration, UrlInputElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public UrlInputElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: UrlInputElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
The string is sent as a plain_text text object.
public UrlInputElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: UrlInputElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
public UrlInputElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, UrlInputElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public UrlInputElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: UrlInputElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public UrlInputElement build()
Returns: an immutable UrlInputElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: UrlInputElement
UserMultiSelectElement
A menu for selecting multiple workspace users.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static UserMultiSelectElement.Builder builder()
Returns: a new builder
Related types: UserMultiSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialUsers
Returns user IDs that are selected when the menu loads.
public List<String> getInitialUsers()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetMaxSelectedItems
Returns the maximum number of items a user can select.
public OptionalInt getMaxSelectedItems()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public UserMultiSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: UserMultiSelectElement
InitialUsers
Adds user IDs that are selected when the menu loads.
Each call appends to any values already added.
public UserMultiSelectElement.Builder initialUsers(String... values)
| Parameter | Description |
|---|---|
values | values appended in order |
Returns: this builder
Related types: UserMultiSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public UserMultiSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, UserMultiSelectElement
MaxSelectedItems
Sets the maximum number of items a user can select.
public UserMultiSelectElement.Builder maxSelectedItems(int value)
| Parameter | Description |
|---|---|
value | value for Slack's max_selected_items field |
Returns: this builder
Related types: UserMultiSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public UserMultiSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: UserMultiSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public UserMultiSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: UserMultiSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public UserMultiSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, UserMultiSelectElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public UserMultiSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: UserMultiSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public UserMultiSelectElement build()
Returns: an immutable UserMultiSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: UserMultiSelectElement
UserSelectElement
A menu for selecting one workspace user.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
actionId.
See the Slack reference.
Builder
Starts a new builder.
public static UserSelectElement.Builder builder()
Returns: a new builder
Related types: UserSelectElement
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public String getActionId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetInitialUser
Returns the user ID selected when the menu loads.
public Optional<String> getInitialUser()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetFocusOnLoad
Returns whether the element receives focus when the view opens. Only one element per view may do so.
public Optional<Boolean> getFocusOnLoad()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPlaceholder
Returns the placeholder text shown before a value is chosen.
public Optional<PlainText> getPlaceholder()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Required. Slack allows at most 255 characters.
public UserSelectElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: UserSelectElement
InitialUser
Sets the user ID selected when the menu loads.
public UserSelectElement.Builder initialUser(String value)
| Parameter | Description |
|---|---|
value | value for Slack's initial_user field |
Returns: this builder
Related types: UserSelectElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public UserSelectElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, UserSelectElement
FocusOnLoad
Sets whether the element receives focus when the view opens. Only one element per view may do so.
public UserSelectElement.Builder focusOnLoad(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's focus_on_load field |
Returns: this builder
Related types: UserSelectElement
Placeholder — String
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public UserSelectElement.Builder placeholder(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: UserSelectElement
Placeholder — PlainText
Sets the placeholder text shown before a value is chosen.
Slack allows at most 150 characters.
public UserSelectElement.Builder placeholder(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, UserSelectElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public UserSelectElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: UserSelectElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public UserSelectElement build()
Returns: an immutable UserSelectElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: UserSelectElement
WorkflowButtonElement
A button that starts a workflow through a link trigger.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
text,workflow.
See the Slack reference.
Builder
Starts a new builder.
public static WorkflowButtonElement.Builder builder()
Returns: a new builder
Related types: WorkflowButtonElement
GetText
Returns the button label.
public PlainText getText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetWorkflow
Returns the workflow started when the button is clicked.
public Workflow getWorkflow()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Workflow
GetActionId
Returns the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
public Optional<String> getActionId()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetConfirm
Returns a confirmation dialog shown before the action is sent.
public Optional<Confirmation> getConfirm()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Confirmation
GetStyle
Returns the button's emphasis. Omit it for the default neutral style.
public Optional<ButtonStyle> getStyle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ButtonStyle
GetAccessibilityLabel
Returns the label read by screen readers in place of the visible text.
public Optional<String> getAccessibilityLabel()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Text — String
Sets the button label.
Required. The string is sent as a plain_text text object.
public WorkflowButtonElement.Builder text(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: WorkflowButtonElement
Text — PlainText
Sets the button label.
Required.
public WorkflowButtonElement.Builder text(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, WorkflowButtonElement
PlainText
Sets the button label.
Required. Equivalent to text(String).
public WorkflowButtonElement.Builder plainText(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: WorkflowButtonElement
Workflow
Sets the workflow started when the button is clicked.
Required.
public WorkflowButtonElement.Builder workflow(Workflow value)
| Parameter | Description |
|---|---|
value | nested Workflow |
Returns: this builder
Related types: Workflow, WorkflowButtonElement
ActionId
Sets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
Slack allows at most 255 characters.
public WorkflowButtonElement.Builder actionId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's action_id field |
Returns: this builder
Related types: WorkflowButtonElement
Confirm
Sets a confirmation dialog shown before the action is sent.
public WorkflowButtonElement.Builder confirm(Confirmation value)
| Parameter | Description |
|---|---|
value | nested Confirmation |
Returns: this builder
Related types: Confirmation, WorkflowButtonElement
Style
Sets the button's emphasis. Omit it for the default neutral style.
public WorkflowButtonElement.Builder style(ButtonStyle value)
| Parameter | Description |
|---|---|
value | value for Slack's style field |
Returns: this builder
Related types: ButtonStyle, WorkflowButtonElement
AccessibilityLabel
Sets the label read by screen readers in place of the visible text.
public WorkflowButtonElement.Builder accessibilityLabel(String value)
| Parameter | Description |
|---|---|
value | value for Slack's accessibility_label field |
Returns: this builder
Related types: WorkflowButtonElement
WireField
Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.
The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.
public WorkflowButtonElement.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: WorkflowButtonElement
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public WorkflowButtonElement build()
Returns: an immutable WorkflowButtonElement
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: WorkflowButtonElement