Elements
This page documents the public C# API for elements, generated from the XML documentation of the compiled library. Values are immutable, constructors take named arguments and validate them, and read-only properties return what was passed.
ButtonElement
An interactive button that sends a payload or opens a URL.
- Required:
text.
See the Slack reference.
Implements IElement.
ButtonElement
Creates and validates a ButtonElement.
public ButtonElement(PlainText text, string? actionId = null, string? url = null, string? value = null, ButtonStyle? style = null, Confirmation? confirm = null, string? accessibilityLabel = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | The button label. Required. Slack allows at most 75 characters. A string is sent as a plain_text text object. |
actionId | 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. |
url | 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. |
value | The application-defined value sent in interaction payloads. Slack allows at most 2000 characters. |
style | The button's emphasis. Omit it for the default neutral style. |
confirm | A confirmation dialog shown before the action is sent. |
accessibilityLabel | The label read by screen readers in place of the visible text. Slack allows at most 75 characters. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ButtonElement, ButtonStyle, Confirmation, PlainText
Text
Gets the button label.
public PlainText Text { get; }
Related types: PlainText, Text
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Url
Gets a URL opened in the user's browser when the button is clicked. Slack still sends an interaction payload.
The value, or null when it was not set.
public string? Url { get; }
Value
Gets the application-defined value sent in interaction payloads.
The value, or null when it was not set.
public string? Value { get; }
Style
Gets the button's emphasis. Omit it for the default neutral style.
The value, or null when it was not set.
public ButtonStyle? Style { get; }
Related types: ButtonStyle
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
AccessibilityLabel
Gets the label read by screen readers in place of the visible text.
The value, or null when it was not set.
public string? AccessibilityLabel { get; }
ButtonStyle
Visual emphasis for buttons and confirmation dialogs.
ToWireValue() returns the value Slack expects in JSON.
| Constant | Slack value | Meaning |
|---|---|---|
Primary | primary | Green emphasis for the affirmative action. |
Danger | danger | Red emphasis for destructive actions. |
ChannelMultiSelectElement
A menu for selecting multiple public channels.
See the Slack reference.
Implements IElement, IInputElement.
ChannelMultiSelectElement
Creates and validates a ChannelMultiSelectElement.
public ChannelMultiSelectElement(string? actionId = null, IEnumerable<string>? initialChannels = null, Confirmation? confirm = null, int? maxSelectedItems = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialChannels | Channel IDs that are selected when the menu loads. |
confirm | A confirmation dialog shown before the action is sent. |
maxSelectedItems | The maximum number of items a user can select. Must be at least 1. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ChannelMultiSelectElement, Confirmation, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialChannels
Gets channel IDs that are selected when the menu loads.
The values in order, or an empty list when none were set.
public IReadOnlyList<string> InitialChannels { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
MaxSelectedItems
Gets the maximum number of items a user can select.
The value, or null when it was not set.
public int? MaxSelectedItems { get; }
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
ChannelSelectElement
A menu for selecting one public channel.
See the Slack reference.
Implements IElement, IInputElement.
ChannelSelectElement
Creates and validates a ChannelSelectElement.
public ChannelSelectElement(string? actionId = null, string? initialChannel = null, bool? responseUrlEnabled = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialChannel | The channel ID selected when the menu loads. |
responseUrlEnabled | Whether the selected conversation receives a response URL in the view submission payload. Only valid in modals. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ChannelSelectElement, Confirmation, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialChannel
Gets the channel ID selected when the menu loads.
The value, or null when it was not set.
public string? InitialChannel { get; }
ResponseUrlEnabled
Gets whether the selected conversation receives a response URL in the view submission payload. Only valid in modals.
The value, or null when it was not set.
public bool? ResponseUrlEnabled { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
CheckboxesElement
A group of checkboxes.
- Required:
options.
See the Slack reference.
Implements IElement, IInputElement.
CheckboxesElement
Creates and validates a CheckboxesElement.
public CheckboxesElement(string? actionId, IEnumerable<Option> options, IEnumerable<Option>? initialOptions = null, Confirmation? confirm = null, bool? focusOnLoad = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
options | Selectable options in display order. Required. Must contain between 1 and 10 items. |
initialOptions | Options that are selected when the element loads. Each must match an option in the element. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: CheckboxesElement, Confirmation, Option
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Options
Gets selectable options in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> Options { get; }
Related types: Option
InitialOptions
Gets options that are selected when the element loads. Each must match an option in the element.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> InitialOptions { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
ConversationMultiSelectElement
A menu for selecting multiple conversations.
See the Slack reference.
Implements IElement, IInputElement.
ConversationMultiSelectElement
Creates and validates a ConversationMultiSelectElement.
public ConversationMultiSelectElement(string? actionId = null, IEnumerable<string>? initialConversations = null, bool? defaultToCurrentConversation = null, ConversationFilter? filter = null, Confirmation? confirm = null, int? maxSelectedItems = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialConversations | Conversation IDs that are selected when the menu loads. |
defaultToCurrentConversation | Whether the menu pre-selects the conversation the user is viewing. |
filter | Which conversation types the menu offers. |
confirm | A confirmation dialog shown before the action is sent. |
maxSelectedItems | The maximum number of items a user can select. Must be at least 1. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, ConversationFilter, ConversationMultiSelectElement, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialConversations
Gets conversation IDs that are selected when the menu loads.
The values in order, or an empty list when none were set.
public IReadOnlyList<string> InitialConversations { get; }
DefaultToCurrentConversation
Gets whether the menu pre-selects the conversation the user is viewing.
The value, or null when it was not set.
public bool? DefaultToCurrentConversation { get; }
Filter
Gets which conversation types the menu offers.
The value, or null when it was not set.
public ConversationFilter? Filter { get; }
Related types: ConversationFilter
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
MaxSelectedItems
Gets the maximum number of items a user can select.
The value, or null when it was not set.
public int? MaxSelectedItems { get; }
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
ConversationSelectElement
A menu for selecting one conversation.
See the Slack reference.
Implements IElement, IInputElement.
ConversationSelectElement
Creates and validates a ConversationSelectElement.
public ConversationSelectElement(string? actionId = null, string? initialConversation = null, bool? defaultToCurrentConversation = null, ConversationFilter? filter = null, bool? responseUrlEnabled = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialConversation | The conversation ID selected when the menu loads. |
defaultToCurrentConversation | Whether the menu pre-selects the conversation the user is viewing. |
filter | Which conversation types the menu offers. |
responseUrlEnabled | Whether the selected conversation receives a response URL in the view submission payload. Only valid in modals. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, ConversationFilter, ConversationSelectElement, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialConversation
Gets the conversation ID selected when the menu loads.
The value, or null when it was not set.
public string? InitialConversation { get; }
DefaultToCurrentConversation
Gets whether the menu pre-selects the conversation the user is viewing.
The value, or null when it was not set.
public bool? DefaultToCurrentConversation { get; }
Filter
Gets which conversation types the menu offers.
The value, or null when it was not set.
public ConversationFilter? Filter { get; }
Related types: ConversationFilter
ResponseUrlEnabled
Gets whether the selected conversation receives a response URL in the view submission payload. Only valid in modals.
The value, or null when it was not set.
public bool? ResponseUrlEnabled { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
DatePickerElement
A calendar date picker.
See the Slack reference.
Implements IElement, IInputElement.
DatePickerElement
Creates and validates a DatePickerElement.
public DatePickerElement(string? actionId = null, string? initialDate = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialDate | The initially selected date, formatted as YYYY-MM-DD. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, DatePickerElement, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialDate
Gets the initially selected date, formatted as YYYY-MM-DD.
The value, or null when it was not set.
public string? InitialDate { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
DateTimePickerElement
A combined date and time picker.
See the Slack reference.
Implements IElement, IInputElement.
DateTimePickerElement
Creates and validates a DateTimePickerElement.
public DateTimePickerElement(string? actionId = null, long? initialDateTime = null, Confirmation? confirm = null, bool? focusOnLoad = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialDateTime | The initially selected moment as a UNIX timestamp in seconds. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, DateTimePickerElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialDateTime
Gets the initially selected moment as a UNIX timestamp in seconds.
The value, or null when it was not set.
public long? InitialDateTime { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
EmailInputElement
A single-line input that accepts an email address.
See the Slack reference.
Implements IElement, IInputElement.
EmailInputElement
Creates and validates a EmailInputElement.
public EmailInputElement(string? actionId = null, string? initialValue = null, DispatchActionConfiguration? dispatchActionConfig = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialValue | The value present when the input loads. |
dispatchActionConfig | Which user interactions send a block_actions payload. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DispatchActionConfiguration, EmailInputElement, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialValue
Gets the value present when the input loads.
The value, or null when it was not set.
public string? InitialValue { get; }
DispatchActionConfig
Gets which user interactions send a block_actions payload.
The value, or null when it was not set.
public DispatchActionConfiguration? DispatchActionConfig { get; }
Related types: DispatchActionConfiguration
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
ExternalMultiSelectElement
A menu for selecting multiple options loaded from your app.
See the Slack reference.
Implements IElement, IInputElement.
ExternalMultiSelectElement
Creates and validates a ExternalMultiSelectElement.
public ExternalMultiSelectElement(string? actionId = null, int? minQueryLength = null, IEnumerable<Option>? initialOptions = null, Confirmation? confirm = null, int? maxSelectedItems = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
minQueryLength | How many characters the user must type before Slack queries your options endpoint. |
initialOptions | Options that are selected when the element loads. Each must match an option in the element. |
confirm | A confirmation dialog shown before the action is sent. |
maxSelectedItems | The maximum number of items a user can select. Must be at least 1. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, ExternalMultiSelectElement, Option, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
MinQueryLength
Gets how many characters the user must type before Slack queries your options endpoint.
The value, or null when it was not set.
public int? MinQueryLength { get; }
InitialOptions
Gets options that are selected when the element loads. Each must match an option in the element.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> InitialOptions { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
MaxSelectedItems
Gets the maximum number of items a user can select.
The value, or null when it was not set.
public int? MaxSelectedItems { get; }
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
ExternalSelectElement
A menu for selecting one option loaded from your app.
See the Slack reference.
Implements IElement, IInputElement.
ExternalSelectElement
Creates and validates a ExternalSelectElement.
public ExternalSelectElement(string? actionId = null, int? minQueryLength = null, Option? initialOption = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
minQueryLength | How many characters the user must type before Slack queries your options endpoint. |
initialOption | The option selected when the element loads. It must match an option in the element. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, ExternalSelectElement, Option, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
MinQueryLength
Gets how many characters the user must type before Slack queries your options endpoint.
The value, or null when it was not set.
public int? MinQueryLength { get; }
InitialOption
Gets the option selected when the element loads. It must match an option in the element.
The value, or null when it was not set.
public Option? InitialOption { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
FeedbackButtonsElement
A pair of thumbs-up and thumbs-down feedback buttons.
- Required:
positiveButton,negativeButton.
See the Slack reference.
Implements IContextActionsElement, IElement.
FeedbackButtonsElement
Creates and validates a FeedbackButtonsElement.
public FeedbackButtonsElement(FeedbackButton positiveButton, FeedbackButton negativeButton, string? actionId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
positiveButton | The button for positive feedback. Required. |
negativeButton | The button for negative feedback. Required. |
actionId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: FeedbackButton, FeedbackButtonsElement
PositiveButton
Gets the button for positive feedback.
public FeedbackButton PositiveButton { get; }
Related types: FeedbackButton
NegativeButton
Gets the button for negative feedback.
public FeedbackButton NegativeButton { get; }
Related types: FeedbackButton
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
FileInputElement
An input that lets users upload files.
See the Slack reference.
Implements IElement, IInputElement.
FileInputElement
Creates and validates a FileInputElement.
public FileInputElement(string? actionId = null, IEnumerable<string>? filetypes = null, int? maxFiles = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
filetypes | Accepted file extensions, such as pdf or png. |
maxFiles | The maximum number of files a user can upload. Must be between 1 and 10. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: FileInputElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Filetypes
Gets accepted file extensions, such as pdf or png.
The values in order, or an empty list when none were set.
public IReadOnlyList<string> Filetypes { get; }
MaxFiles
Gets the maximum number of files a user can upload.
The value, or null when it was not set.
public int? MaxFiles { get; }
IconButtonElement
A button that shows an icon instead of text.
- Required:
text,icon.
See the Slack reference.
Implements IContextActionsElement, IElement.
IconButtonElement
Creates and validates a IconButtonElement.
public IconButtonElement(PlainText text, IconButtonIcon? icon = null, string? actionId = null, string? value = null, Confirmation? confirm = null, string? accessibilityLabel = null, IEnumerable<string>? visibleToUserIds = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | The text used as the button's accessible name. Required. A string is sent as a plain_text text object. |
icon | The icon shown on the button. Required. |
actionId | 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. |
value | The application-defined value sent in interaction payloads. Slack allows at most 2000 characters. |
confirm | A confirmation dialog shown before the action is sent. |
accessibilityLabel | The label read by screen readers in place of the visible text. Slack allows at most 75 characters. |
visibleToUserIds | The IDs of users who can see this button. Slack allows at most 10 items. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, IconButtonElement, IconButtonIcon, PlainText
Text
Gets the text used as the button's accessible name.
public PlainText Text { get; }
Related types: PlainText, Text
Icon
Gets the icon shown on the button.
public IconButtonIcon? Icon { get; }
Related types: IconButtonIcon
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Value
Gets the application-defined value sent in interaction payloads.
The value, or null when it was not set.
public string? Value { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
AccessibilityLabel
Gets the label read by screen readers in place of the visible text.
The value, or null when it was not set.
public string? AccessibilityLabel { get; }
VisibleToUserIds
Gets the IDs of users who can see this button.
The values in order, or an empty list when none were set.
public IReadOnlyList<string> VisibleToUserIds { get; }
IconButtonIcon
Icons supported by icon buttons.
ToWireValue() returns the value Slack expects in JSON.
| Constant | Slack value | Meaning |
|---|---|---|
Trash | trash | A trash can, for delete actions. |
IElement
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.
IInputElement
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.
ImageElement
An image displayed inside a section, context, or card.
- Required:
altText. - Provide exactly one of an image URL or a Slack file.
See the Slack reference.
Implements IContextElement, IElement.
ImageElement
Creates and validates a ImageElement.
public ImageElement(string altText, string? imageUrl = null, SlackFile? slackFile = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
altText | A plain-text summary of the image or video for assistive technology. Required. Slack allows at most 2000 characters. |
imageUrl | The publicly accessible URL of the image. Cannot be combined with a Slack file. Slack allows at most 3000 characters. |
slackFile | A file hosted in Slack as the image source. Cannot be combined with an image URL. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ImageElement, SlackFile
AltText
Gets a plain-text summary of the image or video for assistive technology.
public string AltText { get; }
ImageUrl
Gets the publicly accessible URL of the image. Cannot be combined with a Slack file.
The value, or null when it was not set.
public string? ImageUrl { get; }
SlackFile
Gets a file hosted in Slack as the image source. Cannot be combined with an image URL.
The value, or null when it was not set.
public SlackFile? SlackFile { get; }
Related types: SlackFile
NumberInputElement
An input that accepts whole or decimal numbers.
- Required:
isDecimalAllowed. - The minimum value cannot exceed the maximum value.
See the Slack reference.
Implements IElement, IInputElement.
NumberInputElement
Creates and validates a NumberInputElement.
public NumberInputElement(string? actionId = null, bool? isDecimalAllowed = null, string? initialValue = null, double? minValue = null, double? maxValue = null, DispatchActionConfiguration? dispatchActionConfig = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
isDecimalAllowed | Whether the input accepts decimal numbers. Required. |
initialValue | The number present when the input loads, as a string such as 42 or 3.5. |
minValue | The smallest accepted number. |
maxValue | The largest accepted number. |
dispatchActionConfig | Which user interactions send a block_actions payload. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DispatchActionConfiguration, NumberInputElement, PlainText
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
IsDecimalAllowed
Gets whether the input accepts decimal numbers.
The value, or null when it was not set.
public bool? IsDecimalAllowed { get; }
InitialValue
Gets the number present when the input loads, as a string such as 42 or 3.5.
The value, or null when it was not set.
public string? InitialValue { get; }
MinValue
Gets the smallest accepted number.
The value, or null when it was not set.
public double? MinValue { get; }
MaxValue
Gets the largest accepted number.
The value, or null when it was not set.
public double? MaxValue { get; }
DispatchActionConfig
Gets which user interactions send a block_actions payload.
The value, or null when it was not set.
public DispatchActionConfiguration? DispatchActionConfig { get; }
Related types: DispatchActionConfiguration
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
OverflowElement
A compact menu of up to five options.
- Required:
options.
See the Slack reference.
Implements IElement.
OverflowElement
Creates and validates a OverflowElement.
public OverflowElement(string? actionId, IEnumerable<Option> options, Confirmation? confirm = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
options | Selectable options in display order. Required. Must contain between 1 and 5 items. |
confirm | A confirmation dialog shown before the action is sent. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, Option, OverflowElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Options
Gets selectable options in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> Options { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
PlainTextInputElement
A single-line or multi-line free-text input.
See the Slack reference.
Implements IElement, IInputElement.
PlainTextInputElement
Creates and validates a PlainTextInputElement.
public PlainTextInputElement(string? actionId = null, string? initialValue = null, bool? multiline = null, int? minLength = null, int? maxLength = null, DispatchActionConfiguration? dispatchActionConfig = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialValue | The value present when the input loads. |
multiline | Whether the input is a multi-line text area. |
minLength | The minimum number of characters the user must enter. Must be between 0 and 3000. |
maxLength | The maximum number of characters the user can enter. Must be between 1 and 3000. |
dispatchActionConfig | Which user interactions send a block_actions payload. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DispatchActionConfiguration, PlainText, PlainTextInputElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialValue
Gets the value present when the input loads.
The value, or null when it was not set.
public string? InitialValue { get; }
Multiline
Gets whether the input is a multi-line text area.
The value, or null when it was not set.
public bool? Multiline { get; }
MinLength
Gets the minimum number of characters the user must enter.
The value, or null when it was not set.
public int? MinLength { get; }
MaxLength
Gets the maximum number of characters the user can enter.
The value, or null when it was not set.
public int? MaxLength { get; }
DispatchActionConfig
Gets which user interactions send a block_actions payload.
The value, or null when it was not set.
public DispatchActionConfiguration? DispatchActionConfig { get; }
Related types: DispatchActionConfiguration
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
RadioButtonsElement
A group of radio buttons.
- Required:
options.
See the Slack reference.
Implements IElement, IInputElement.
RadioButtonsElement
Creates and validates a RadioButtonsElement.
public RadioButtonsElement(string? actionId, IEnumerable<Option> options, Option? initialOption = null, Confirmation? confirm = null, bool? focusOnLoad = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
options | Selectable options in display order. Required. Must contain between 1 and 10 items. |
initialOption | The option selected when the element loads. It must match an option in the element. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, Option, RadioButtonsElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Options
Gets selectable options in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> Options { get; }
Related types: Option
InitialOption
Gets the option selected when the element loads. It must match an option in the element.
The value, or null when it was not set.
public Option? InitialOption { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
RichTextInputElement
An input that accepts formatted rich text.
- Required:
actionId.
See the Slack reference.
Implements IElement, IInputElement.
RichTextInputElement
Creates and validates a RichTextInputElement.
public RichTextInputElement(string actionId, RichTextBlock? initialValue = null, DispatchActionConfiguration? dispatchActionConfig = null, bool? focusOnLoad = null, PlainText? placeholder = null, int? minLines = null, int? maxLines = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialValue | The rich text present when the input loads. |
dispatchActionConfig | Which user interactions send a block_actions payload. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
minLines | The minimum visible height of the input, in lines. Must be between 1 and 100. |
maxLines | The maximum visible height of the input, in lines. Must be between 1 and 100. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DispatchActionConfiguration, PlainText, RichTextBlock, RichTextInputElement
ActionId
Gets 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 ActionId { get; }
InitialValue
Gets the rich text present when the input loads.
The value, or null when it was not set.
public RichTextBlock? InitialValue { get; }
Related types: RichTextBlock
DispatchActionConfig
Gets which user interactions send a block_actions payload.
The value, or null when it was not set.
public DispatchActionConfiguration? DispatchActionConfig { get; }
Related types: DispatchActionConfiguration
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
MinLines
Gets the minimum visible height of the input, in lines.
The value, or null when it was not set.
public int? MinLines { get; }
MaxLines
Gets the maximum visible height of the input, in lines.
The value, or null when it was not set.
public int? MaxLines { get; }
StaticMultiSelectElement
A menu for selecting multiple options defined in the payload.
- Use options or option groups, not both.
See the Slack reference.
Implements IElement, IInputElement.
StaticMultiSelectElement
Creates and validates a StaticMultiSelectElement.
public StaticMultiSelectElement(string? actionId = null, IEnumerable<Option>? options = null, IEnumerable<OptionGroup>? optionGroups = null, IEnumerable<Option>? initialOptions = null, Confirmation? confirm = null, int? maxSelectedItems = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
options | Selectable options in display order. Slack allows at most 100 items. |
optionGroups | Labelled groups of options in display order. Cannot be combined with ungrouped options. Slack allows at most 100 items. |
initialOptions | Options that are selected when the element loads. Each must match an option in the element. |
confirm | A confirmation dialog shown before the action is sent. |
maxSelectedItems | The maximum number of items a user can select. Must be at least 1. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, Option, OptionGroup, PlainText, StaticMultiSelectElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Options
Gets selectable options in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> Options { get; }
Related types: Option
OptionGroups
Gets labelled groups of options in display order. Cannot be combined with ungrouped options.
The values in order, or an empty list when none were set.
public IReadOnlyList<OptionGroup> OptionGroups { get; }
Related types: OptionGroup
InitialOptions
Gets options that are selected when the element loads. Each must match an option in the element.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> InitialOptions { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
MaxSelectedItems
Gets the maximum number of items a user can select.
The value, or null when it was not set.
public int? MaxSelectedItems { get; }
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
StaticSelectElement
A menu for selecting one option defined in the payload.
- Use options or option groups, not both.
See the Slack reference.
Implements IElement, IInputElement.
StaticSelectElement
Creates and validates a StaticSelectElement.
public StaticSelectElement(string? actionId = null, IEnumerable<Option>? options = null, IEnumerable<OptionGroup>? optionGroups = null, Option? initialOption = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
options | Selectable options in display order. Slack allows at most 100 items. |
optionGroups | Labelled groups of options in display order. Cannot be combined with ungrouped options. Slack allows at most 100 items. |
initialOption | The option selected when the element loads. It must match an option in the element. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, Option, OptionGroup, PlainText, StaticSelectElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Options
Gets selectable options in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<Option> Options { get; }
Related types: Option
OptionGroups
Gets labelled groups of options in display order. Cannot be combined with ungrouped options.
The values in order, or an empty list when none were set.
public IReadOnlyList<OptionGroup> OptionGroups { get; }
Related types: OptionGroup
InitialOption
Gets the option selected when the element loads. It must match an option in the element.
The value, or null when it was not set.
public Option? InitialOption { get; }
Related types: Option
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
TimePickerElement
A time-of-day picker.
See the Slack reference.
Implements IElement, IInputElement.
TimePickerElement
Creates and validates a TimePickerElement.
public TimePickerElement(string? actionId = null, string? initialTime = null, string? timezone = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialTime | The initially selected time, formatted as HH:mm in 24-hour time. |
timezone | The IANA time zone used to display the time, such as Australia/Brisbane. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, PlainText, TimePickerElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialTime
Gets the initially selected time, formatted as HH:mm in 24-hour time.
The value, or null when it was not set.
public string? InitialTime { get; }
Timezone
Gets the IANA time zone used to display the time, such as Australia/Brisbane.
The value, or null when it was not set.
public string? Timezone { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
UrlInputElement
A single-line input that accepts a URL.
See the Slack reference.
Implements IElement, IInputElement.
UrlInputElement
Creates and validates a UrlInputElement.
public UrlInputElement(string? actionId = null, string? initialValue = null, DispatchActionConfiguration? dispatchActionConfig = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialValue | The value present when the input loads. |
dispatchActionConfig | Which user interactions send a block_actions payload. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DispatchActionConfiguration, PlainText, UrlInputElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialValue
Gets the value present when the input loads.
The value, or null when it was not set.
public string? InitialValue { get; }
DispatchActionConfig
Gets which user interactions send a block_actions payload.
The value, or null when it was not set.
public DispatchActionConfiguration? DispatchActionConfig { get; }
Related types: DispatchActionConfiguration
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
UserMultiSelectElement
A menu for selecting multiple workspace users.
See the Slack reference.
Implements IElement, IInputElement.
UserMultiSelectElement
Creates and validates a UserMultiSelectElement.
public UserMultiSelectElement(string? actionId = null, IEnumerable<string>? initialUsers = null, Confirmation? confirm = null, int? maxSelectedItems = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialUsers | User IDs that are selected when the menu loads. |
confirm | A confirmation dialog shown before the action is sent. |
maxSelectedItems | The maximum number of items a user can select. Must be at least 1. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, PlainText, UserMultiSelectElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialUsers
Gets user IDs that are selected when the menu loads.
The values in order, or an empty list when none were set.
public IReadOnlyList<string> InitialUsers { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
MaxSelectedItems
Gets the maximum number of items a user can select.
The value, or null when it was not set.
public int? MaxSelectedItems { get; }
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
UserSelectElement
A menu for selecting one workspace user.
See the Slack reference.
Implements IElement, IInputElement.
UserSelectElement
Creates and validates a UserSelectElement.
public UserSelectElement(string? actionId = null, string? initialUser = null, Confirmation? confirm = null, bool? focusOnLoad = null, PlainText? placeholder = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
actionId | 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. |
initialUser | The user ID selected when the menu loads. |
confirm | A confirmation dialog shown before the action is sent. |
focusOnLoad | Whether the element receives focus when the view opens. Only one element per view may do so. |
placeholder | The placeholder text shown before a value is chosen. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: Confirmation, PlainText, UserSelectElement
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
InitialUser
Gets the user ID selected when the menu loads.
The value, or null when it was not set.
public string? InitialUser { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
FocusOnLoad
Gets whether the element receives focus when the view opens. Only one element per view may do so.
The value, or null when it was not set.
public bool? FocusOnLoad { get; }
Placeholder
Gets the placeholder text shown before a value is chosen.
The value, or null when it was not set.
public PlainText? Placeholder { get; }
Related types: PlainText
WorkflowButtonElement
A button that starts a workflow through a link trigger.
- Required:
text,workflow,actionId.
See the Slack reference.
Implements IElement.
WorkflowButtonElement
Creates and validates a WorkflowButtonElement.
public WorkflowButtonElement(PlainText text, Workflow workflow, string? actionId = null, Confirmation? confirm = null, ButtonStyle? style = null, string? accessibilityLabel = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | The button label. Required. Slack allows at most 75 characters. A string is sent as a plain_text text object. |
workflow | The workflow started when the button is clicked. Required. |
actionId | 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. |
confirm | A confirmation dialog shown before the action is sent. |
style | The button's emphasis. Omit it for the default neutral style. |
accessibilityLabel | The label read by screen readers in place of the visible text. Slack allows at most 75 characters. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ButtonStyle, Confirmation, PlainText, Workflow, WorkflowButtonElement
Text
Gets the button label.
public PlainText Text { get; }
Related types: PlainText, Text
Workflow
Gets the workflow started when the button is clicked.
public Workflow Workflow { get; }
Related types: Workflow
ActionId
Gets the identifier Slack returns in interaction payloads when a user acts on this element. It must be unique among the elements of its block.
The value, or null when it was not set.
public string? ActionId { get; }
Confirm
Gets a confirmation dialog shown before the action is sent.
The value, or null when it was not set.
public Confirmation? Confirm { get; }
Related types: Confirmation
Style
Gets the button's emphasis. Omit it for the default neutral style.
The value, or null when it was not set.
public ButtonStyle? Style { get; }
Related types: ButtonStyle
AccessibilityLabel
Gets the label read by screen readers in place of the visible text.
The value, or null when it was not set.
public string? AccessibilityLabel { get; }