Skip to content

Commit

Permalink
new select example
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 17, 2024
1 parent 29fdb32 commit 7183e1a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 12 deletions.
3 changes: 1 addition & 2 deletions examples/multiselect_huge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ fn main() {
.option(DemandOption::new("Skittles"))
.option(DemandOption::new("Starburst"))
.option(DemandOption::new("Twizzlers"))
.option(DemandOption::new("Milk Duds"))
;
.option(DemandOption::new("Milk Duds"));
ms.run().expect("error running multi select");
}
52 changes: 42 additions & 10 deletions examples/select.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
use demand::{DemandOption, Select};

fn main() {
let ms = Select::new("Toppings")
.description("Select your toppings")
let ms = Select::new("Country")
.description("Pick a country")
.filterable(true)
.option(DemandOption::new("Lettuce").selected(true))
.option(DemandOption::new("Tomatoes").selected(true))
.option(DemandOption::new("Charm Sauce"))
.option(DemandOption::new("Jalapenos").label("Jalapeños"))
.option(DemandOption::new("Cheese"))
.option(DemandOption::new("Vegan Cheese"))
.option(DemandOption::new("Nutella"));
ms.run().expect("error running multi select");
.option(DemandOption::new("US").label("United States").selected(true))
.option(DemandOption::new("DE").label("Germany"))
.option(DemandOption::new("BR").label("Brazil"))
.option(DemandOption::new("CA").label("Canada"))
.option(DemandOption::new("MX").label("Mexico"))
.option(DemandOption::new("FR").label("France"))
.option(DemandOption::new("IT").label("Italy"))
.option(DemandOption::new("ES").label("Spain"))
.option(DemandOption::new("JP").label("Japan"))
.option(DemandOption::new("CN").label("China"))
.option(DemandOption::new("IN").label("India"))
.option(DemandOption::new("RU").label("Russia"))
.option(DemandOption::new("AU").label("Australia"))
.option(DemandOption::new("GB").label("United Kingdom"))
.option(DemandOption::new("NL").label("Netherlands"))
.option(DemandOption::new("SE").label("Sweden"))
.option(DemandOption::new("CH").label("Switzerland"))
.option(DemandOption::new("NO").label("Norway"))
.option(DemandOption::new("DK").label("Denmark"))
.option(DemandOption::new("BE").label("Belgium"))
.option(DemandOption::new("AT").label("Austria"))
.option(DemandOption::new("PL").label("Poland"))
.option(DemandOption::new("TR").label("Turkey"))
.option(DemandOption::new("CZ").label("Czech Republic"))
.option(DemandOption::new("IE").label("Ireland"))
.option(DemandOption::new("SG").label("Singapore"))
.option(DemandOption::new("HK").label("Hong Kong"))
.option(DemandOption::new("KR").label("South Korea"))
.option(DemandOption::new("AR").label("Argentina"))
.option(DemandOption::new("CL").label("Chile"))
.option(DemandOption::new("CO").label("Colombia"))
.option(DemandOption::new("PE").label("Peru"))
.option(DemandOption::new("VE").label("Venezuela"))
.option(DemandOption::new("UA").label("Ukraine"))
.option(DemandOption::new("RO").label("Romania"))
.option(DemandOption::new("ZA").label("South Africa"))
.option(DemandOption::new("EG").label("Egypt"))
.option(DemandOption::new("SA").label("Saudi Arabia"))
.option(DemandOption::new("AE").label("United Arab Emirates"));
ms.run().expect("error running select");
}

0 comments on commit 7183e1a

Please sign in to comment.