Documentation
¶
Index ¶
- Constants
- type BasicTextFieldConstructorArgs
- type Composable
- type Composer
- type TextFieldOption
- func WithDecorator(decorator input.TextFieldDecorator) TextFieldOption
- func WithEnabled(enabled bool) TextFieldOption
- func WithInputTransformation(t input.InputTransformation) TextFieldOption
- func WithKeyboardActionHandler(handler input.KeyboardActionHandler) TextFieldOption
- func WithLineLimits(limits input.TextFieldLineLimits) TextFieldOption
- func WithModifier(m ui.Modifier) TextFieldOption
- func WithOnLayout(onLayout func(text.TextLayoutResult)) TextFieldOption
- func WithOutputTransformation(t input.OutputTransformation) TextFieldOption
- func WithReadOnly(readOnly bool) TextFieldOption
- func WithTextStyle(ts *text.TextStyle) TextFieldOption
- type TextFieldOptions
- type TextStyle
Constants ¶
const BasicTextFieldNodeID = "BasicTextField"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicTextFieldConstructorArgs ¶
type BasicTextFieldConstructorArgs struct {
// contains filtered or unexported fields
}
BasicTextFieldConstructorArgs holds the arguments for the text field widget constructor.
type Composable ¶
type Composable = api.Composable
func BasicTextField ¶
func BasicTextField( state *input.TextFieldState, onValueChange func(string), options ...TextFieldOption, ) Composable
BasicTextField is an interactive text input composable that accepts text input through software or hardware keyboard, but provides no decorations like hint or placeholder.
All editing state is hoisted through the TextFieldState parameter. Whenever the contents change via user input or semantics, the state is updated. Similarly, all programmatic updates to the state reflect in the composable.
To add decorations (icons, labels, helper text), use the WithDecorator option.
To filter or transform input, use WithInputTransformation.
To control line limits and scrolling, use WithLineLimits.
This is a port of androidx.compose.foundation.text.BasicTextField.
type TextFieldOption ¶
type TextFieldOption func(*TextFieldOptions)
TextFieldOption is a functional option for configuring BasicTextField.
func WithDecorator ¶
func WithDecorator(decorator input.TextFieldDecorator) TextFieldOption
WithDecorator sets the text field decorator.
func WithEnabled ¶
func WithEnabled(enabled bool) TextFieldOption
WithEnabled sets the enabled state.
func WithInputTransformation ¶
func WithInputTransformation(t input.InputTransformation) TextFieldOption
WithInputTransformation sets the input transformation.
func WithKeyboardActionHandler ¶
func WithKeyboardActionHandler(handler input.KeyboardActionHandler) TextFieldOption
WithKeyboardActionHandler sets the keyboard action handler.
func WithLineLimits ¶
func WithLineLimits(limits input.TextFieldLineLimits) TextFieldOption
WithLineLimits sets the line limits for wrapping and height.
func WithModifier ¶
func WithModifier(m ui.Modifier) TextFieldOption
WithModifier sets the modifier for the text field.
func WithOnLayout ¶
func WithOnLayout(onLayout func(text.TextLayoutResult)) TextFieldOption
WithOnLayout sets the text layout callback.
func WithOutputTransformation ¶
func WithOutputTransformation(t input.OutputTransformation) TextFieldOption
WithOutputTransformation sets the output transformation.
func WithReadOnly ¶
func WithReadOnly(readOnly bool) TextFieldOption
WithReadOnly sets the read-only state.
func WithTextStyle ¶
func WithTextStyle(ts *text.TextStyle) TextFieldOption
WithTextStyle sets the text style.
type TextFieldOptions ¶
type TextFieldOptions struct {
// Modifier to apply to the text field.
Modifier ui.Modifier
// Enabled controls the enabled state. When false, the field is not editable
// or focusable, and input is not selectable.
Enabled bool
// ReadOnly controls the editable state. When true, the field cannot be
// modified but can be focused and text can be copied.
ReadOnly bool
// TextStyle configures typography and graphics for the text content.
TextStyle *text.TextStyle
// InputTransformation filters/transforms user input after it's received
// but before it's committed to the TextFieldState.
InputTransformation input.InputTransformation
// OutputTransformation transforms text for visual presentation only,
// without affecting the underlying TextFieldState.
OutputTransformation input.OutputTransformation
// LineLimits specifies text wrapping and height behavior.
LineLimits input.TextFieldLineLimits
// OnTextLayout is called when the text layout becomes queryable.
OnTextLayout func(text.TextLayoutResult)
// KeyboardActionHandler handles IME action events.
KeyboardActionHandler input.KeyboardActionHandler
// Decorator allows adding decorations around the text field.
Decorator input.TextFieldDecorator
}
TextFieldOptions configures a BasicTextField.
func DefaultTextFieldOptions ¶
func DefaultTextFieldOptions() TextFieldOptions
DefaultTextFieldOptions returns the default options for BasicTextField.