Diberikan kolom input dan tugasnya adalah mengatur jumlah minimum/maksimum karakter yang diperbolehkan dalam kolom input dalam HTML
- To set the maximum character limit in input field, we use maxlength attribute. This attribute is used to specify the maximum number of characters enters into the element.
- To set the minimum character limit in input field, we use minlength attribute. This attribute is used to specify the minimum number of characters enters into the element.
Sintaksis.
<input maxlength="number1"> <input minlength="number2">Nilai Atribut.
- number1: It contains single value number which allows the maximum number of character in element. Its default value is 524288.
- nomor 2. Jumlah minimum karakter yang diperlukan di kolom input
Contoh 1. Tetapkan batas jumlah maksimum karakter yang diperbolehkan di kolom input
HTML
<!DOCTYPE html>
<html>
<head>
<<!DOCTYPE html>0>
<!DOCTYPE html>2<!DOCTYPE html>3
<!DOCTYPE html>4<!DOCTYPE html>5
<!DOCTYPE html>2<!DOCTYPE html>7
<!DOCTYPE html>2<!DOCTYPE html>9
<!DOCTYPE html>4<1
<!DOCTYPE html>2<!DOCTYPE html>7
<5<!DOCTYPE html>0>
<5head>
<html2>
<html6html7html6>
<>2>
<!DOCTYPE html>2>5
<!DOCTYPE html>2>7>8>9
<!DOCTYPE html>2<1
<5>2>
<<8 <9head0head1>
<!DOCTYPE html>2head4
<!DOCTYPE html>2<head7 head8head0<!DOCTYPE html>09 <!DOCTYPE html>10head0<!DOCTYPE html>12>
Terakhir, panduan interaktivitas pengguna penanganan kami akan membantu Anda menyiapkan aplikasi untuk memungkinkan penggunaan komponen interaktif yang tercantum di bawah
Daftar kolom dan nilai di bawah menjelaskan JSON yang dapat digunakan aplikasi untuk menghasilkan setiap elemen
Elemen tombol
Bekerja dengan tipe blok.
Komponen interaktif yang menyisipkan tombol. Tombol tersebut dapat menjadi pemicu untuk apa saja mulai dari membuka tautan sederhana hingga memulai alur kerja yang kompleks
Untuk menggunakan komponen interaktif, Anda perlu membuat beberapa perubahan untuk mempersiapkan aplikasi Anda. Baca panduan kami untuk mengaktifkan interaktivitas
Bidang
FieldTypeDiperlukan?Deskripsi{ "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } 2StringYaJenis elemen. Dalam hal ini { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _2 selalu { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } 4. { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } 5ObjectYesA yang menentukan teks tombol. Hanya bisa dari { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _6. { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _5 dapat dipotong dengan ~30 karakter. Panjang maksimum untuk { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _5 di kolom ini adalah 75 karakter. { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _9StringYesPengidentifikasi untuk tindakan ini. Anda dapat menggunakan ini saat menerima payload interaksi. Harus unik di antara semua { "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _9 lainnya di blok penampung. Panjang maksimum untuk kolom ini adalah 255 karakter. { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } 1StringNoA URL untuk dimuat di browser pengguna saat tombol diklik. Panjang maksimum untuk bidang ini adalah 3000 karakter. Jika Anda menggunakan { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } _1, Anda masih akan menerima dan harus. { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } 3StringNoNilai untuk dikirim bersama dengan. Panjang maksimum untuk bidang ini adalah 2000 karakter. { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } 4StringNoMenghias tombol dengan skema warna visual alternatif. Gunakan opsi ini dengan menahan diri{ "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } _5 memberi tombol garis tepi hijau dan teks, ideal untuk tindakan afirmasi atau konfirmasi. { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } _5 hanya boleh digunakan untuk satu tombol dalam satu set
{ "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } _7 memberi tombol garis merah dan teks, dan harus digunakan saat tindakan merusak. Gunakan { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } _7 bahkan lebih hemat daripada { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } 5
Jika Anda tidak menyertakan kolom ini, gaya tombol default akan digunakan
Gambar di atas menunjukkan tiga pilihan gaya yang berbeda
{ "type": "section", "block_id": "section1234", "text": { "type": "mrkdwn", "text": "Pick a date for the deadline." }, "accessory": { "type": "datepicker", "action_id": "datepicker123", "initial_date": "1990-04-28", "placeholder": { "type": "plain_text", "text": "Select a date" } } } 0ObjectNoA yang menentukan dialog konfirmasi opsional setelah tombol diklik. { "type": "section", "block_id": "section1234", "text": { "type": "mrkdwn", "text": "Pick a date for the deadline." }, "accessory": { "type": "datepicker", "action_id": "datepicker123", "initial_date": "1990-04-28", "placeholder": { "type": "plain_text", "text": "Select a date" } } } 1StringNoA label untuk teks deskriptif yang lebih panjang tentang elemen tombol. Label ini akan dibacakan oleh pembaca layar, bukan oleh tombol. Panjang maksimum untuk bidang ini adalah 75 karakterContoh
Tombol interaktif biasa
{ "type": "button", "text": { "type": "plain_text", "text": "Click Me" }, "value": "click_me_123", "action_id": "button" }Tombol dengan atribut { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } _5 { "type": "modal", "title": { "type": "plain_text", "text": "My App", "emoji": true }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "section", "text": { "type": "plain_text", "text": "Check out these charming checkboxes" }, "accessory": { "type": "checkboxes", "action_id": "this_is_an_action_id", "initial_options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }], "options": [ { "value": "A1", "text": { "type": "plain_text", "text": "Checkbox 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Checkbox 2" } } ] } } ] } 4
{ "type": "button", "text": { "type": "plain_text", "text": "Save" }, "style": "primary", "value": "click_me_123", "action_id": "button" }Tombol tautan
{ "type": "button", "text": { "type": "plain_text", "text": "Link Button" }, "url": "//api.slack.com/block-kit" } _Lihat contoh
Grup kotak centang
Bekerja dengan tipe blok.
Grup kotak centang yang memungkinkan pengguna memilih beberapa item dari daftar opsi yang memungkinkan
Kotak centang hanya didukung di permukaan aplikasi berikut. Tab Beranda Modals Pesan
Untuk menggunakan komponen interaktif seperti ini, Anda perlu membuat beberapa perubahan untuk mempersiapkan aplikasi Anda. Baca panduan kami untuk mengaktifkan interaktivitas