FaSelection
🟡 Needs container
🟡 Doesn't accepts child/children
Variants
pub enum SelectorVariant {
Outlined,
Default,
Underlined,
}
Colors
pub enum SelectorColor {
Default,
Primary,
Secondary,
Success,
Danger,
Warning,
Info,
}
Sizes
pub enum SelectionSize {
Small,
Normal,
Large,
}
Shapes
pub enum SelectorShape {
Default,
Round,
Rectangle
}
Widget API
pub fn fa_selection<'a>(
builder: &'a mut FamiqWidgetBuilder,
placeholder: &str
) -> FaSelectionBuilder<'a> {
// ..
}
Usage
let selection = fa_selection(&mut builder, "Select choice")
.choices(["Choice 1", "Choice 2"])
.build();
Return Entity of the widget which must be used as child of FaContainer widget.
Built-in classes
-
Color:
is-primary,is-secondary,is-warning,is-info,is-success,is-danger. -
Size:
is-small,is-normal,is-large. -
Shapes:
is-round,is-rectangle. -
Variant:
is-underlined,is-outlined.
Example
let plans = fa_selection(&mut builder, "Select plan")
.id("#plan")
.class("is-info")
.choices(["Personal", "Team", "Enterprise"])
.build();
);
let subscriptions = fa_selection(&mut builder, "Select subscription payment")
.class("is-rectangle")
.choices(["Weekly", "Monthly", "Annually"])
.build();
);
fa_container(&mut builder).children([plans, subscriptions]).build();

Resource
pub struct FaSelectionResource;
-
FaSelectionResourcecan be used to retrieve specificfa_selectionvalue by eitheridorentity.Available methods:
get_value_by_id: get input value by id, returnempty stringit id doesn't exist.get_value_by_entity: get input value by entity, returnempty stringit entity doesn't exist.
Example of using
FaSelectionResourcefn my_system(input_res: Res<FaSelectionResource>) { // some logic .. // get value let text = input_res.get_value_by_id("#plan"); }