plushie/widget/text_input
TextInput widget builder (single-line text entry).
Types
Leading or trailing edge for a text input’s icon.
pub type IconSide {
Left
Right
}
Constructors
-
Left -
Right
Option type for text input properties.
pub type Opt {
Placeholder(String)
Padding(padding.Padding)
Width(length.Length)
Size(Float)
Font(font.Font)
LineHeight(line_height.LineHeight)
AlignX(alignment.Alignment)
TextDirection(text_direction.TextDirection)
Icon(TextInputIcon)
OnSubmit(Bool)
OnPaste(Bool)
Secure(Bool)
InputPurpose(input_purpose.InputPurpose)
Style(String)
PlaceholderColor(color.Color)
SelectionColor(color.Color)
Required(Bool)
Validation(validation_state.ValidationState)
A11y(a11y.A11y)
}
Constructors
-
Placeholder(String) -
Padding(padding.Padding) -
Width(length.Length) -
Size(Float) -
Font(font.Font) -
LineHeight(line_height.LineHeight) -
AlignX(alignment.Alignment) -
TextDirection(text_direction.TextDirection) -
Icon(TextInputIcon) -
OnSubmit(Bool) -
OnPaste(Bool) -
Secure(Bool) -
InputPurpose(input_purpose.InputPurpose) -
Style(String) -
PlaceholderColor(color.Color) -
SelectionColor(color.Color) -
Required(Bool) -
Validation(validation_state.ValidationState) -
A11y(a11y.A11y)
Glyph displayed inside a text input.
code_point is a single-character string identifying the glyph from
font (an icon font when set, the default font otherwise). size
and spacing are the pixel size of the glyph and the spacing
between the glyph and the text. side selects the leading or
trailing edge.
pub type TextInputIcon {
TextInputIcon(
code_point: String,
size: option.Option(Float),
spacing: option.Option(Float),
side: option.Option(IconSide),
font: option.Option(font.Font),
)
}
Constructors
-
TextInputIcon( code_point: String, size: option.Option(Float), spacing: option.Option(Float), side: option.Option(IconSide), font: option.Option(font.Font), )
Values
pub fn a11y(input: TextInput, a: a11y.A11y) -> TextInput
Set accessibility properties for this widget.
pub fn align_x(
input: TextInput,
a: alignment.Alignment,
) -> TextInput
Set the horizontal alignment.
pub fn icon(input: TextInput, i: TextInputIcon) -> TextInput
Set an icon inside the input field.
pub fn input_purpose(
input: TextInput,
p: input_purpose.InputPurpose,
) -> TextInput
Set the input purpose hint for IME keyboards.
pub fn line_height(
input: TextInput,
lh: line_height.LineHeight,
) -> TextInput
Set the line height.
pub fn placeholder_color(
input: TextInput,
c: color.Color,
) -> TextInput
Set the placeholder text color.
pub fn required(input: TextInput, r: Bool) -> TextInput
Mark this field as required. Flows into a11y.required.
pub fn selection_color(
input: TextInput,
c: color.Color,
) -> TextInput
Set the text selection highlight color.
pub fn text_direction(
input: TextInput,
direction: text_direction.TextDirection,
) -> TextInput
Set the text direction used by logical text layout.
Placeholder text uses the same direction hint as the input value.
pub fn validation(
input: TextInput,
v: validation_state.ValidationState,
) -> TextInput
Set the form-validation state. Flows into a11y.invalid and
a11y.error_message automatically.