-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileInput.java
More file actions
31 lines (29 loc) · 1.29 KB
/
Copy pathFileInput.java
File metadata and controls
31 lines (29 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package elements;
import com.slack.api.model.block.Blocks;
import com.slack.api.model.block.composition.BlockCompositions;
import com.slack.api.model.block.element.BlockElements;
import com.slack.api.model.view.View;
import com.slack.api.model.view.Views;
import java.util.List;
/**
* Allows user to upload files.
* {@link https://docs.slack.dev/reference/block-kit/block-elements/file-input-element/}
*/
public class FileInput {
/**
* A modal view with a file input element hosted in an input block.
*/
public static View example01() {
View view = Views.view(v -> v.type("modal")
.title(Views.viewTitle(t -> t.type("plain_text").text("My App").emoji(true)))
.submit(Views.viewSubmit(
s -> s.type("plain_text").text("Submit").emoji(true)))
.close(Views.viewClose(c -> c.type("plain_text").text("Cancel").emoji(true)))
.blocks(List.of(Blocks.input(i -> i.blockId("input_block_id")
.label(BlockCompositions.plainText("Upload Files"))
.element(BlockElements.fileInput(f -> f.actionId("file_input_action_id_1")
.filetypes(List.of("jpg", "png"))
.maxFiles(5)))))));
return view;
}
}