FaTextInput
🟡 Needs container
🟡 Doesn't accept child/children
Variants
pub enum TextInputVariant {
Default,
Outlined,
Underlined,
}
Colors
pub enum TextInputColor {
Default,
Primary,
Secondary,
Success,
Danger,
Warning,
Info,
}
Sizes
pub enum TextInputSize {
Small,
Normal,
Large,
}
Shapes
pub enum TextInputShape {
Default,
Round,
Rectangle
}
Widget API
pub fn fa_text_input<'a>(
builder: &'a mut FamiqWidgetBuilder,
placeholder: &str
) -> FaTextInputBuilder<'a> {
// ..
}
Usage
let input = fa_text_input(&mut builder, "Enter your name").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
// default
let input_default = fa_text_input(&mut builder, "Enter your name")
.id("#name-input")
.build();
// info & large
let input_info_large = fa_text_input(&mut builder, "Enter your name")
.class("is-info is-large")
.build();
// warning & round
let input_warning_round = fa_text_input(&mut builder, "Enter your name")
.class("is-warning is-round")
.build();
fa_container(&mut builder)
.children([input_default, input_info_large, input_warning_round])
.build();

Resource
pub struct FaTextInputResource;
-
FaTextInputResourcecan be used to retrieve specificfa_text_inputvalue 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
FaTextInputResourcefn my_system(input_res: Res<FaTextInputResource>) { // some logic .. // get value let text = input_res.get_value_by_id("#name-input"); }