Elements

Visual components like text or for user input, such as a button or checkbox.

Elements represent the smallest pieces of a view. Elements must be rendered within layout components.

When working with events from the App Home page, put your elements in an actions block.

Button

Available in: Section | Actions

An interactive button. The button can be a trigger for anything from opening a simple link to starting a complex workflow.

Button Example

Examples

Render a button within an actions block.

- definition: actions
  name: "apex_actions"
  components:
    - definition: button
      properties:
        label: "Confirm"
        style: "primary"
        name: "confirm_button"
components:
  - definition: button
    properties:
      name: "my_button"
      label: "Delete"
      value: "delete_record"
      style: "danger"
    events:
      onclick:
        definition: "apex__action__ViewRecord"
        properties:
          recordId: "006R0000003FpnoIAC"
          objectApiName: "Opportunity"

Keys

Key Type Required Description
definition String Yes The value must be button.
properties Object Yes The component's properties.
properties.label String, Plain Text, Expression No The button label.
properties.name String, Expression Yes The name applied to the button element. The name is used to retrieve the value on submission.
properties.value String, Expression No The value to send along with the interaction payload.
properties.style String. Possible values, primary, danger, null No The button style. The default value is null.
properties.url String, Expression No A URL that's opened on button click. URLs must use a valid protocol scheme such as http:// or https://.
properties.confirm Confirm No A confirmation dialog to display after a button click.
events Object No Events that trigger an action.
events.onclick Object No Fires when a user clicks the button.
events.onclick.definition String No The identifier of the action that executes when the event fires.
events.onclick.properties Object No Properties to pass to the action.

Checkbox

Available in: Section | Actions | Input

A checkbox that allows a user to specify a single boolean value.

Checkbox Example

Examples

This example shows a checkbox that defaults to selected.

components:
  - definition: checkbox
    properties:
      label: "Select single boolean value"
      name: "checkbox"
      value: true

This example shows checkboxes that render as selected or unselected, a checkbox with a label, and a required checkbox.

description: "Example usage of the checkbox component"
components:
  - definition: modal
    properties:
      title: "Checkbox Example"
      submitLabel: "Submit"
      closeLabel: "Cancel"
    components:
      - definition: input
        name: "default_selected_checkbox"
        properties:
          label: "Checkbox Default Selected"
        components:
          - definition: checkbox
            properties:
              name: "checkbox1"
              value: true
      - definition: input
        name: "default_unselected_checkbox"
        properties:
          label: "Checkbox Default Unselected"
        components:
          - definition: checkbox
            properties:
              name: "checkbox2"
              value: false
      - definition: input
        name: "checkbox_with_description"
        properties:
          label: "Checkbox with Label and Description"
        components:
          - definition: checkbox
            properties:
              name: "checkbox3"
              label: Checkbox Label
              description: Checkbox Description
      - definition: input
        name: "required_checkbox"
        properties:
          label: "Required Checkbox"
          required: true
        components:
          - definition: checkbox
            properties:
              name: "checkbox4"

Keys

Key Type Required Description
definition String Yes The value must be checkbox.
properties Object Yes The component's properties.
properties.name String, Expression Yes The name applied to the checkbox input. The name is used to retrieve the value on submission.
properties.value Boolean, Expression No The initial value applied to the checkbox input. Defaults to false.
properties.label String, Expression No The label for the checkbox input.
properties.description String, Expression No The description for the checkbox input.
properties.confirm Confirm, Expression No A confirmation dialog to display after a checkbox is selected.
events Object No Events that trigger an action.
events.onchange Object No Fires when a checkbox is ticked or unticked.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.

Checkbox Group

Available in: Section | Actions | Input

A checkbox group that allows a user to choose multiple items from a list of possible options.

Checkbox Group Example

Example

On an initial render, Option 1 is selected and Option 2 isn't selected by default.

components:
  - definition: checkboxGroup
    properties:
      name: "options_checkbox"
      options:
        - identifier: "option_1"
          label: "Option 1"
          value: true
          description: "This is option 1"
        - identifier: "option_2"
          label: "Option 2"
          value: false

Keys

Key Type Required Description
definition String Yes The value must be checkboxGroup.
properties Object Yes The component's properties.
properties.name String, Expression Yes The name applied to the checkbox inputs. The name is used to retrieve the values on submission.
properties.options Options Yes A list of checkbox items.
properties.confirm Confirm, Expression No A confirmation dialog to display after a checkbox is selected.
events Object No Events that trigger an action.
events.onchange Object No Fires when a checkbox is ticked or unticked.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.

Conversations Select

Available in: Section | Actions | Input

This multi-select menu populates its options with a list of public and private channels, DMs, and multi-party DMs that are visible to the current user in the active workspace.

Conversations Select Example

Example

This example selects a single conversation.

components:
  - definition: input
    name: "conversationsSelectId"
    properties:
      label: "Select a conversation"
    components:
      - definition: conversationsSelect
        properties:
          name: "conversationsSelectName"
          value: "C012AB3CD"
          defaultCurrent: true

This example allows multiple selections.

components:
  - definition: input
    name: "conversationsSelectMultiId"
    properties:
      label: "Select multiple conversations"
    components:
      - definition: conversationsSelect
        properties:
          name: "conversationsSelectMultiName"
          multiselect: true
          value:
            - "C012AB3CD"
            - "C345XY6AB"

This example filters to include only public and private channels.

components:
  - definition: input
    name: "conversationsSelectFilterChannelId"
    properties:
      label: "Select a channel"
    components:
      - definition: conversationsSelect
        properties:
          name: "conversationsSelectName"
          filter:
            include:
              - "public"
              - "private"
            excludeExternalShared: false

This example filters to include direct messages and exclude bots.

components:
  - definition: input
    name: "conversationsSelectFilterDmId"
    properties:
      label: "Select a DM"
    components:
      - definition: conversationsSelect
        properties:
          name: "conversationsSelectName"
          filter:
            include:
              - "im"
              - "mpim"
            excludeBotUsers: true

This example shows a comprehensive usage of the conversationsSelect component.

description: "Example usage of the conversationsSelect component"
components:
  - definition: modal
    properties:
      title: "Conversations Select Example"
      submitLabel: "Submit"
      closeLabel: "Cancel"
    components:
      - definition: section
        properties:
          text: "Single conversation select with required properties only"
      - definition: input
        name: "conversationsSelectId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectName"
      - definition: divider
      - definition: section
        properties:
          text: "Single conversation select with placeholder"
      - definition: input
        name: "conversationsSelectPlaceholderId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectPlaceholderName"
              placeholder: "Choose a conversation"
      - definition: divider
      - definition: section
        properties:
          text: "Single conversation select with default channel selected"
      - definition: input
        name: "conversationsSelectDefaultCurrentId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectDefaultCurrentName"
              defaultCurrent: true
      - definition: divider
      - definition: section
        properties:
          text: "Single conversation select as required input"
      - definition: input
        name: "conversationsSelectRequiredId"
        properties:
          label: "Select a conversation"
          required: true
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectRequiredName"
      - definition: divider
      - definition: section
        properties:
          text: "Single conversation select filtered to only channels"
      - definition: input
        name: "conversationsSelectFilterChannelId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectFilterChannelName"
              filter:
                include:
                  - "public"
                  - "private"
                excludeExternalShared: false
      - definition: divider
      - definition: section
        properties:
          text: "Single conversation select filtered to only direct messages excluding bots"
      - definition: input
        name: "conversationsSelectFilterDmId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectFilterDmName"
              filter:
                include:
                  - "im"
                  - "mpim"
                excludeBotUsers: true
      - definition: divider
      - definition: section
        properties:
          text: "Single conversation select with confirm dialog"
      - definition: input
        name: "conversationsSelectConfirmId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsSelectConfirmName"
              confirm:
                title: "Confirm conversation selection"
                text: "Please confirm the conversation selection"
                confirm: "Confirm"
                deny: "Cancel"
                style: "primary"
      - definition: divider
      - definition: section
        properties:
          text: "Multi conversation select with required properties only"
      - definition: input
        name: "conversationsMultiSelectId"
        properties:
          label: "Select conversations"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsMultiSelectName"
              multiselect: true
      - definition: divider
      - definition: section
        properties:
          text: "Multi conversation select with default channel selected"
      - definition: input
        name: "conversationsMultiSelectDefaultCurrentId"
        properties:
          label: "Select conversations"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsMultiSelectDefaultCurrentName"
              multiselect: true
              defaultCurrent: true
      - definition: divider
      - definition: section
        properties:
          text: "Multi conversation select with max selection"
      - definition: input
        name: "conversationsMultiSelectMaxSelectionId"
        properties:
          label: "Select conversations"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsMultiSelectMaxSelectionName"
              multiselect: true
              maxSelection: 2
      - definition: divider
      - definition: section
        properties:
          text: "Multi conversation select filtered to only channels"
      - definition: input
        name: "conversationsMultiSelectFilterChannelId"
        properties:
          label: "Select conversations"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsMultiSelectFilterChannelName"
              multiselect: true
              filter:
                include:
                  - "public"
                  - "private"
                excludeExternalShared: false
      - definition: divider
      - definition: section
        properties:
          text: "Multi conversation select filtered to only direct messages excluding bots"
      - definition: input
        name: "conversationsMultiSelectFilterDmId"
        properties:
          label: "Select a conversation"
        components:
          - definition: conversationsSelect
            properties:
              name: "conversationsMultiSelectFilterDmName"
              multiselect: true
              filter:
                include:
                  - "im"
                  - "mpim"
                excludeBotUsers: true

Keys

Key Type Required Description
definition String Yes The value must be conversationsSelect.
properties Object Yes The component's properties.
properties.name String, Expression Yes The name applied to the conversations select component. The name is used to retrieve the value on submission.
properties.placeholder String, Expression, Plain Text No A placeholder value to display when nothing is selected.
properties.multiselect Boolean, Expression No Indicates whether the component supports multiple selections. The default value is false.
properties.maxSelection Number, Expression No If multiselect is true, you can optionally specify maxSelection. The maximum number of conversations that can be selected. The minimum value is 1.
properties.defaultCurrent Boolean, Expression No Pre-populates the select with the conversation the user was viewing when they opened the modal. The default value is false.
properties.filter Filter, Expression No Filter the list of available conversations.
properties.confirm Confirm, Expression No A confirmation dialog to display after a conversation is selected.
events Object No Events that trigger an action.
properties.value String, Array, Expression No Indicates the conversation, or conversations if multiselect is true, selected on an initial render. Must match the ID of a conversation in Slack. If the value is an array, it's an array of strings. If defaultCurrent is also supplied, value takes precedence.
events.onchange Object No Fires when a conversation is selected, or the multi-select menu is confirmed.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.

Date Picker

Available in: Section | Actions | Input

An element that lets users select a date from a calendar.

Date Picker Example

warning: The date picker doesn't currently support multiple time zones, which can lead to issues when editing and submitting values. For example, if the field value is stored as 11:00 pm PST on 3/9/2022, the date picker displays the date incorrectly as 3/9/2022 for users in EST. The date picker does not display the time zone or convert the date to the local time zone.

Examples

This example shows a date picker that displays a confirmation dialog after a date is selected.

components:
  - definition: input
    name: "exampleDatepicker"
    properties:
      label: "Example datepicker"
    components:
      - definition: datepicker
        properties:
          value: "2021-04-01"
          placeholder: "Choose a date"
          name: "exampleDatepicker"
          confirm: "{!view.properties.confirm}"
            title: "Confirm date selection"
            text: "Please confirm the date selection"
            confirm: "Confirm"
            deny: "Cancel"
            style: "primary"

This example shows various ways to use a date picker.

components:
  - definition: modal
    properties:
      title: "Datepicker Example"
      submitLabel: "Submit"
      closeLabel: "Cancel"
    components:
      - definition: section
        properties:
          text: "Datepicker with required properties only"
      - definition: input
        name: "exampleDatepickerId"
        properties:
          label: "Pick a date"
        components:
          - definition: datepicker
            properties:
              name: "exampleDatepickerName"
      - definition: divider
      - definition: section
        properties:
          text: "Datepicker with placeholder"
      - definition: input
        name: "exampleDatepickerPlaceholderId"
        properties:
          label: "Pick a date"
        components:
          - definition: datepicker
            properties:
              placeholder: "Choose a date"
              name: "exampleDatepickerPlaceholderName"
      - definition: divider
      - definition: section
        properties:
          text: "Datepicker with initial date"
      - definition: input
        name: "exampleDatepickerInitialDateId"
        properties:
          label: "Pick a date"
        components:
          - definition: datepicker
            properties:
              value: "2021-04-01"
              name: "exampleDatepickerInitialDateName"
      - definition: divider
      - definition: section
        properties:
          text: "Datepicker as required input"
          required: true
      - definition: input
        name: "exampleDatepickerRequiredId"
        properties:
          label: "Pick a date"
        components:
          - definition: datepicker
            properties:
              name: "exampleDatepickerRequiredName"

Keys

Key Type Required Description
definition String Yes The value must be datepicker.
properties Object Yes The component's properties.
properties.value String, Expression No The initial date that's selected when the date picker is loaded in the format YYYY-MM-DD.
properties.placeholder String, Plain Text, Expression No Text used as a placeholder when the value is empty.
properties.name String, Expression Yes A name applied to the date picker. The name is used to retrieve the values on submission.
properties.confirm Confirm, Expression No A confirmation dialog to display after a date is selected.
events Object No Events that trigger an action.
events.onchange Object No Fires when a date is chosen and the date picker closes.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.

External Select

This component is a lookup that fetches options from a data source when a user enters text into the field. Use List<Slack.Option> or List<Slack.OptionGroup> to create your data source and return it as a Slack.OptionDataResponse object.

Available in: Section | Actions | Input

Multiple Select External Select Input

Example

This example displays a list of accounts by name in an external select component.

components:
    - definition: actions
        name: "external_select_accounts"
        components:
          - definition: externalSelect
            properties:
              placeholder: "Look up an account by name"
              name: "account_lookup"
              datasource:
                definition: "apex__DataProviderAccountLookup.getAccountsByName"

Return data to the External Select component using Slack.OptionDataResponse.

tip: This example is from view_opportunity_by_account.view in the sample app.

public class DataProviderAccountLookup {
    public static Slack.OptionDataResponse getAccountsByName(String value) {
        List<Account> accounts;
        if (String.isNotBlank(value)) {
            String name = '%' + value + '%';
            accounts = [SELECT Id, Name FROM Account WHERE Name LIKE :name WITH SECURITY_ENFORCED LIMIT 10];
        }

        List<Slack.Option> accountOptions = new List<Slack.Option>();
        if (accounts != null) {
            for (Account account : accounts) {
                Slack.Option option = new Slack.Option(account.Name, account.Id);
                accountOptions.add(option);
            }
        }
        return new Slack.OptionDataResponse(accountOptions);
    }
}

Multiple Selection

To allow multiple selections, set the multiselect property to true.

components:
  - definition: externalSelect
    properties:
      multiselect: true
      placeholder: "Select one or more opportunities"
      name: "external_select_multi"
      datasource:
        definition: "apex__MyDataProvider.getOpportunities"
        properties:
          objectApiName: "Opportunity"

Pre-selected Option

Pre-selecting renders the select component with a selected value. To pre-select a value, use one of these methods.

  1. Bind an expression directly into the value property. This expression must point to a dataProvider that provides preselected values (see Implement a Data Provider).
  2. Add an array of pre-selected options in the value property, or a single Slack.OptionDataResponse object.

Pre-selected Option Expression Example

components:
  - definition: externalSelect
    properties:
      multiselect: true
      placeholder: "Select one or more opportunities"
      name: "external_select"
      value: "{!recordsLookup}"
      datasource:
        definition: "apex__MyDataProvider.getOpportunities"
        properties:
          objectApiName: "Opportunity"

Pre-selected Option Inline Array Example

components:
  - definition: externalSelect
    properties:
      multiselect: true
      placeholder: "Select one or more opportunities"
      name: "external_select"
      value:
        - text: "Option 1"
          value: "value1"
        - text: "Option 2"
          value: "value2"
      datasource:
        definition: "apex__MyDataProvider.getOpportunities"
        properties:
          objectApiName: "Opportunity"

Keys

Key Type Required Description
definition String Yes The value must be externalSelect.
properties Object Yes The component's properties.
properties.name String, Expression Yes The name applied to the external select items. The name is used to retrieve the value on submission.
properties.placeholder String, Expression, Plain Text No A placeholder value for the externalSelect menu to display when nothing is selected. The default placeholder value is "Select option(s)".
properties.value Object, Array of objects, Expression No Provide a single option object or array of options to set as pre-selected.
properties.value.text String, Plain Text, Mrkdwn Yes A label for the selected item.
properties.value.value String, Plain Text No The value of the selected item.
properties.multiselect Boolean, Expression No Indicates whether the external select component supports multiple selections. The default value is false.
properties.maxSelection Number, Expression No If multiselect is true, you can optionally specify maxSelection. The maximum number of options that can be selected. The minimum value is 1.
properties.minQueryLength Number, Expression No The minimum number of characters that a user must enter into the external select input before results are queried and updated in available selections. The minimum value is 1.
properties.confirm Confirm, Expression No A confirmation dialog to display after a radio button is selected.
properties.datasource String, Object, Expression Yes A valid data provider identifier string or object containing an identifier and properties to be passed into a data provider.
properties.datasource.definition String, Object, Expression Yes A valid data provider identifier is required to be present within the datasource if the datasource takes the form of an Object.
properties.datasource.properties Object, Expression No Contains any parameters to be passed into the option data provider.

Inline Image

Available in: Section | Context

Display an image alongside additional content, such as text.

Inline Image example

tip: For a component that holds only an image, see image. Both image components use - definition: image. However, they're available in different containing components, and the layout image has a title property.

Example

This example is an image within a context component.

components:
  - definition: context
    components:
      - definition: image
        properties:
          url: "https://via.placeholder.com/150"
          altText: "Placeholder image"
      - definition: text
        properties:
          text: "Check out my image"

Keys

Key Type Required Description
definition String Yes The value must be image.
properties Object Yes The component's properties.
properties.url String, Expression Yes The URL of the image to display. URLs must use a valid protocol scheme such as http:// or https://.
properties.altText String, Expression Yes A plain text description of the image.

Overflow

Available in: Section | Actions

An overflow menu in a section or actions component.

Overflow example

Examples

This example creates an overflow menu with 3 options.

components:
  - definition: overflow
    properties:
      name: "overflow_example"
      options:
        - identifier: "option_1"
          label: "Option 1"
        - identifier: "option_2"
          label: "Option 2"
        - identifier: "option_3"
          label: "Option 3"
          url: "https://www.example.com"

This example creates an overflow menu in an actions block.

components:
  - definition: modal
    properties:
      title: "Overflow Example"
      submitLabel: "Submit"
      closeLabel: "Cancel"
    components:
      - definition: actions
        name: "actions_block"
        components:
          - definition: overflow
            properties:
              name: "overflow_in_section"
              options:
                - identifier: "option_1"
                  label: "Option 1"
                - identifier: "option_2"
                  label: "Option 2"
                - identifier: "option_3"
                  label: "Option 3"
                  url: "https://www.example.com"
              confirm:
                title: "Confirm selection"
                text: "Please confirm the selection"
                confirm: "Confirm"
                deny: "Cancel"
                style: "primary"

Keys

Key Type Required Description
definition String Yes The value must be overflow.
properties Object Yes The component's properties.
properties.name String, Expression Yes A name applied to the overflow element, used to retrieve the value when a menu option is selected.
properties.options Options Yes A list of options to display in the overflow menu. A minimum of 2 options is required and a maximum of 5 options is allowed.
properties.confirm Confirm, Expression No A confirmation dialog to display after a checkbox is selected.
events Object No Events that trigger an action.
events.onclick Object No Fires when an item from the overflow menu is clicked.
events.onclick.definition String No The identifier of the action that executes when the event fires.
events.onclick.properties Object No Properties to pass to the action.

Radio Group

Available in: Section | Actions | Input

A radio button group that allows a user to choose one item from a list of possible options.

Radio Button Example

Example

On an initial render, Option 1 is selected.

components:
  - definition: radioGroup
    properties:
      name: "radio_button_group_options"
      value: "option_1"
      options:
        - identifier: "option_1"
          label: "Option 1"
          description: "This is a radio button"
        - identifier: "option_2"
          label: "Option 2"

Keys

Key Type Required Description
definition String Yes The value must be radioGroup.
properties Object Yes The component's properties.
properties.name String, Expression Yes The name applied to the radio button inputs. The name is used to retrieve the values on submission.
properties.value String, Expression No Optionally indicates the value to select on an initial render. Must match the identifier of one of the items passed in to the options field.
properties.options Options Yes A list of radio button items.
properties.confirm Confirm, Expression No A confirmation dialog to display after a radio button is selected.
events Object No Events that trigger an action.
events.onchange Object No Fires when the selected radio in a group of radio buttons is changed.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.

Select

Available in: Section | Actions | Input

A select menu, like a standard HTML <select> tag, creates a dropdown menu with a list of options for a user to choose. The select menu also includes type-ahead functionality, where a user can type a part or all of an option string to filter the list.

Select Example

Menu Options

This example shows a select menu in a modal, with option values specified by options. The optional value parameter provides the input string entered into the select component that's used to perform the lookup. The value you provide preselects an option from the options identifier or from your data provider.

components:
  - definition: modal
    properties:
      title: "Create Opportunity"
      submitLabel: "Create"
    components:
      - definition: input
        properties:
          label: "Stage"
          required: true
        components:
          - definition: select
            properties:
              name: "StageName"
              value: "Prospecting"
              placeholder: "Select a stage."
              options:
                - identifier: "Prospecting"
                  label: "Prospecting"
                - identifier: "Qualification"
                  label: "Qualification"
                - identifier: "Needs Analysis"
                  label: "Needs Analysis"

Alternatively, you can pass an expression to value and use a data provider that returns List<Slack.Option> or List<Slack.OptionGroup>.

description: 'Find and View Opportunities by Account'
schema:
    properties:
        recordId:
            type: string
            required: true
dataproviders:
    opportunity:
        definition: 'apex__DataProviderOpportunityLookup.getOpportunitiesByAccount'
        properties:
            accountId: '{!view.properties.recordId}'
components:
    - definition: modal
      properties:
          title: 'Select an Opportunity'
          submitLabel: 'View Opportunity'
       components:
    - definition: input
      name: "all_opportunities"
      properties:
        label: "All Opportunities By Account"
      components:
        - definition: select
          properties:
            name: "select_opportunity"
            placeholder: "Select an Opportunity"
            options: "{!opportunity}"

Pass in the accountId property to the Apex class.

public static List<Slack.Option> getOpportunitiesByAccount(String accountId) { ... }

tip: This example is from view_opportunity_by_account.view in the sample app.

Select Menu in Actions and Input

Place the select component in an actions block when using it from the App Home page.

- definition: actions
  components:
    - definition: select
      properties:
        name: "select_options"
        value: "option_1"
        placeholder: "Please select an option."
        options:
          - identifier: "option_3"
            label: "Option 3"
          - identifier: "option_4"
            label: "Option 4"
      events:
        onchange:
          definition: "apex__action__homeSelectChanged"

On initial render, Option 1 is selected.

components:
  - definition: input
    name: "input_block"
    properties:
      label: "Select an option"
    components:
      - definition: select
        properties:
          name: "select_options"
          value: "option_1"
          placeholder: "Please select an option."
          options:
            - identifier: "option_1"
              label: "Option 1"
              description: "This is option 1"
            - identifier: "option_2"
              label: "Option 2"
          confirm:
            title: "Confirm select selection"
            text: "Please confirm selection"
            confirm: "Confirm"
            deny: "Cancel"
            style: "primary"
        events:
          onchange:
            definition: "apex__MyDataProvider.ViewAction"

Keys

Key Type Required Description
definition String Yes The value must be select.
properties Object Yes The component's properties.
properties.name String, Expression Yes The name applied to the select items. The name is used to retrieve the value on submission.
properties.placeholder String, Expression, Plain Text No A placeholder value for the select menu to display when nothing is selected. Use a descriptive placeholder like "Select a status" to convey the field's purpose. If you don't include a placeholder, screen readers override the label and announce "Pick an option".
properties.value String, Array of strings, Expression No Optionally indicates the value, or values if multiselect, selected on an initial render. Must match the identifier of one of the options passed to options or optionsGroup.
properties.options Options No Provide a value for options or optionGroups, but not both. A list of selectable items. If more than 100 options are provided, the options items are automatically split into optionGroups of 100 options each.
properties.optionGroups Option Groups No Provide a value for options or optionGroups, but not both. A list of select groups. Each group accepts a label and an array of options. Maximum of 100 options per group.
properties.multiselect Boolean, Expression No Indicates whether the select component supports multiple selections. The default value is false.
properties.maxSelection Number, Expression No If multiselect is true, you can optionally specify maxSelection. The maximum number of options that can be selected. The minimum value is 1.
properties.valueDelimiter String, Expression No If multiselect is true and value resolves to a String that represents a delimited list, specify valueDelimiter with the appropriate list delimiter. For example, a value of option_1;option2 is delimited by ;.
properties.confirm Confirm, Expression No A confirmation dialog to display after an option is selected.
events Object No The events on the select component that trigger actions to execute.
events.onchange Object No An object that defines the action to take when the onchange event fires and the properties to pass to the action.
events.onchange.definition String No The action that executes when a user selects an option.
events.onchange.properties Object No The properties to pass to the action.

Text

Available in: Context

Use this component to render text in a context component only.

Keys

Key Type Required Description
definition String Yes The value must be text.
properties Object Yes The component's properties.
properties.text String, Expression, Plain Text, Mrkdwn Yes The text for the component.

Text Input

Available in: Input

A text input, similar to the HTML <input> tag, creates a field where a user can enter freeform data. It can appear as a single-line field or a larger textarea using the multiline flag.

Text input fields don't currently support the onchange event. You can trigger an interaction payload only by pressing the submit button on your modal.

Text Input Example

Example

components:
  - definition: input
    name: "input_block"
    properties:
      label: "Name"
    components:
      - definition: textInput
        properties:
          name: "text_input"
          placeholder: "Enter Name"
          value: "Global Media - 400 Widgets"
          minLength: 2

Keys

Key Type Required Description
definition String Yes The value must be textInput.
properties Object Yes The component's properties.
properties.name String Expression No An identifier used to retrieve the value on submission.
properties.placeholder String, Expression, Plain Text No A placeholder value for the select menu to display when nothing is selected.
properties.value String, Expression No The initial value for the input field.
properties.minLength Integer, Expression No The minimum number of characters allowed on form submission.
properties.maxLength Integer, Expression No The maximum number of characters allowed on form submission.
properties.multiline Boolean, Expression No If true, the input field supports multiple lines. The default value is false.

Time Picker

Available in: Section | Actions | Input

Select a time of day to a 15-minute increment.

Time Picker Example

The time picker renders as a select element. Slack's time picker element is in beta and isn't used by Apex SDK for Slack.

warning: The time picker doesn't currently support multiple time zones, which can lead to issues when editing and submitting values. For example, if the field value is stored as 11:00 pm PST on 3/9/2022, the time picker displays the time incorrectly as 11:00 pm for users in EST. The time picker does not display the time zone or convert the date to the local time zone.

Example

components:
  - definition: input
    name: "exampleTimepicker"
    properties:
      label: "Example timepicker"
      hint: "Format: HH:mm"
    components:
      - definition: timepicker
        properties:
          value: "09:00"
          placeholder: "Provide a time"
          name: "exampleTimepicker"

Keys

Key Type Required Description
definition String Yes The value must be timepicker.
properties Object Yes The component's properties.
properties.value String, Expression No The initial time that's selected when the time picker is loaded. The format is HH:mm where HH is 24-hour format of an hour (00 to 23) and mm is minutes with leading zeros (00 to 59). The time zone is local to the Slack user client.
properties.placeholder String, Plain Text, Expression No Text used as a placeholder when the value is empty.
properties.name String, Expression Yes A name applied to the time picker. The name is used to retrieve the value on submission.
properties.confirm Confirm, Expression No A confirmation dialog to display after a time is selected.
events Object No Events that trigger an action.
events.onchange Object No Fires when a time is chosen in the time picker.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.

Users Select

Available in: Section | Actions | Input

This multi-select menu populates its options with a list of Slack users visible to the current user in the active workspace.

Users Select Example

Example

This example allows a single selection.

components:
  - definition: input
    name: "usersSelectId"
    properties:
      label: "Select a user"
    components:
      - definition: usersSelect
        properties:
          name: "usersSelectName"
          value: "U01KHPH4A6T"

This example allows multiple selections.

components:
  - definition: input
    name: "usersSelectMultiId"
    properties:
      label: "Select multiple users"
    components:
      - definition: usersSelect
        properties:
          name: "usersSelectMultiName"
          multiselect: true
          value:
            - "U01KHPH4A6T"
            - "WAWUZ49PT"

This example shows a comprehensive usage of the usersSelect component.

description: "Example usage of the usersSelect component"
components:
  - definition: modal
    properties:
      title: "Users Select Example"
      submitLabel: "Submit"
      closeLabel: "Cancel"
    components:
      - definition: section
        properties:
          text: "Single user select with required properties only"
      - definition: input
        name: "usersSelectId"
        properties:
          label: "Select a user"
        components:
          - definition: usersSelect
            properties:
              name: "usersSelectName"
      - definition: divider
      - definition: section
        properties:
          text: "Single user select with placeholder"
      - definition: input
        name: "usersSelectPlaceholderId"
        properties:
          label: "Select a user"
        components:
          - definition: usersSelect
            properties:
              name: "usersSelectPlaceholderName"
              placeholder: "Choose a user"
      - definition: divider
      - definition: section
        properties:
          text: "Single user select with initial user"
      - definition: input
        name: "usersSelectInitialUserId"
        properties:
          label: "Select a user"
        components:
          - definition: usersSelect
            properties:
              name: "usersSelectInitialUserName"
              value: "USLACKBOT"
      - definition: divider
      - definition: section
        properties:
          text: "Single user select as required input"
      - definition: input
        name: "usersSelectRequiredId"
        properties:
          label: "Select a user"
          required: true
        components:
          - definition: usersSelect
            properties:
              name: "usersSelectRequiredName"
      - definition: divider
      - definition: section
        properties:
          text: "Single user select with confirm dialog"
      - definition: input
        name: "usersSelectConfirmId"
        properties:
          label: "Select a user"
        components:
          - definition: usersSelect
            properties:
              name: "usersSelectConfirmName"
              confirm:
                title: "Confirm user selection"
                text: "Please confirm the user selection"
                confirm: "Confirm"
                deny: "Cancel"
                style: "primary"
      - definition: divider
      - definition: section
        properties:
          text: "Multi user select with required properties only"
      - definition: input
        name: "usersMultiSelectId"
        properties:
          label: "Select users"
        components:
          - definition: usersSelect
            properties:
              name: "usersMultiSelectName"
              multiselect: true
      - definition: divider
      - definition: section
        properties:
          text: "Multi user select with initial users"
      - definition: input
        name: "usersMultiSelectInitialUsersId"
        properties:
          label: "Select users"
        components:
          - definition: usersSelect
            properties:
              name: "usersMultiSelectInitialUsersName"
              multiselect: true
              value:
                - "USLACKBOT"
                - "U01KZHYT6RY" # Slack Developer Tools user; depending on the workspace used this user may not exist
      - definition: divider
      - definition: section
        properties:
          text: "Multi user select with max selection"
      - definition: input
        name: "usersMultiSelectMaxSelectionId"
        properties:
          label: "Select users"
        components:
          - definition: usersSelect
            properties:
              name: "usersMultiSelectMaxSelectionName"
              multiselect: true
              maxSelection: 2

Keys

Key Type Required Description
definition String Yes The value must be usersSelect.
properties Object Yes The component's properties.
properties.name String, Expression No An identifier used to retrieve the value on submission.
properties.placeholder String, Expression, Plain Text No A placeholder value to display when nothing is selected.
properties.value String, Array, Expression No Indicates the user, or users if multiselect, selected on an initial render. Must match the ID of a user in Slack. If the value is an array, it's an array of strings.
properties.confirm Confirm, Expression No A confirmation dialog to display after a radio button is selected.
properties.multiselect Boolean, Expression No Indicates whether the select component supports multiple selections. The default value is false.
properties.maxSelection Number, Expression No If multiselect is true, you can optionally specify maxSelection. The maximum number of options that can be selected. The minimum value is 1.
events Object No Events that trigger an action.
events.onchange Object No Fires when a user is selected, or the multi-select menu is confirmed.
events.onchange.definition String No The identifier of the action that executes when the event fires.
events.onchange.properties Object No Properties to pass to the action.