Function slack_blocks::blox::checkboxes[][src]

pub fn checkboxes() -> CheckboxesBuilderInit<'static>
This is supported on crate feature blox only.
Expand description

elems::Checkboxes - <checkboxes>

Build a elems::Checkboxes

Attributes

AttributeTypeOptionalAvailable as child
action_idString or &str
optioncompose::Opt (<option>)*(or options)
optionsVec of compose::Opt*(or option)
initial_optionsVec of compose::Opt* provided via option or options.
confirmcompose::Confirm (<confirm>)

* Options cannot have URL set, option text can be mrkdwn or plain.

Example

use slack_blocks::{blox::*, compose::Opt, elems::Checkboxes};

let xml: Checkboxes = blox! {
  <checkboxes action_id="chex">
    <option value="check_1">
      <text kind=plain>"Foo"</text>
    </option>
    <option value="check_2">
      <text kind=mrkdwn>"Bar"</text>
    </option>
    <option value="check_3">
      <text kind=plain>"Zoo"</text>
    </option>
  </checkboxes>
};

let equiv = Checkboxes::builder().action_id("chex")
                                 .option(Opt::builder().value("check_1")
                                                       .text_plain("Foo")
                                                       .build())
                                 .option(Opt::builder().value("check_2")
                                                       .text_md("Bar")
                                                       .build())
                                 .option(Opt::builder().value("check_3")
                                                       .text_plain("Zoo")
                                                       .build())
                                 .build();

assert_eq!(xml, equiv)