+
+def multi_select_block(label, name, placeholder, options,
+ initial_options=None):
+
+ multi_select = {
+ "action_id": name,
+ "type": "multi_static_select",
+ "placeholder": {
+ "type": "plain_text",
+ "text": placeholder
+ },
+ "options": [
+ {
+ "text": {
+ "type": "plain_text",
+ "text": option
+ },
+ "value": option
+ } for option in options
+ ]
+ }
+
+ if initial_options:
+ multi_select["initial_options"] = [
+ {
+ "text": {
+ "type": "plain_text",
+ "text": option
+ },
+ "value": option
+ } for option in initial_options
+ ]
+
+ return accessory_block(
+ section_block(text_block("*{}*".format(label)), block_id=name),
+ multi_select
+ )