Skip to main content

optgroup_labeled

Function optgroup_labeled 

Source
pub fn optgroup_labeled(label_text: impl AsRef<str>) -> Element
Expand description

An <optgroup label="…">. Fill it with options_from through Element::children_from.

§Examples

use molt::prelude::*;
let options = options_from([("poa", "Porto Alegre")], None);
let south = optgroup_labeled("Sul").children_from(options);
assert_eq!(
    south.render(),
    r#"<optgroup label="Sul"><option value="poa">Porto Alegre</option></optgroup>"#
);