class
UI::TextField
- UI::TextField
- UI::View
- Reference
- Object
Overview
An editable single-line text input field.
Provides placeholder text, secure entry mode for passwords, keyboard type hints, and a change callback.
Defined in:
ui/views/text_field.crConstructors
-
.new(placeholder : String = "", *, name : String | Nil = nil, text : String = "")
Construct a TextField.
-
.new(placeholder : String = "", *, name : String | Nil = nil, text : String = "", &block : String -> Nil)
Convenience constructor with a change handler block.
Instance Method Summary
-
#accept(visitor : PlatformVisitor)
Accept a platform visitor for rendering dispatch.
-
#font : Font
Font for the text field content
-
#font=(font : Font)
Font for the text field content
-
#keyboard_type : KeyboardType
Keyboard type hint for platform input method
-
#keyboard_type=(keyboard_type : KeyboardType)
Keyboard type hint for platform input method
-
#name : String | Nil
Name attribute for web POST submission.
-
#name=(name : String | Nil)
Name attribute for web POST submission.
-
#on_change : Proc(String, Nil) | Nil
Callback invoked when the text value changes.
-
#on_change=(on_change : Proc(String, Nil) | Nil)
Callback invoked when the text value changes.
-
#placeholder : String
Placeholder text shown when empty
-
#placeholder=(placeholder : String)
Placeholder text shown when empty
-
#secure_entry : Bool
Whether input is obscured (password entry)
-
#secure_entry=(secure_entry : Bool)
Whether input is obscured (password entry)
-
#text : String
Current text value
-
#text=(text : String)
Current text value
-
#text_color : Color
Text color
-
#text_color=(text_color : Color)
Text color
Instance methods inherited from class UI::View
accept(visitor : PlatformVisitor)
accept,
accessibility_label : String | Nil
accessibility_label,
accessibility_label=(accessibility_label : String | Nil)
accessibility_label=,
background : Color | Nil
background,
background=(background : Color | Nil)
background=,
blur_radius : Float64
blur_radius,
blur_radius=(blur_radius : Float64)
blur_radius=,
border_color : Color | Nil
border_color,
border_color=(border_color : Color | Nil)
border_color=,
border_width : Float64
border_width,
border_width=(border_width : Float64)
border_width=,
clip_to_bounds : Bool
clip_to_bounds,
clip_to_bounds=(clip_to_bounds : Bool)
clip_to_bounds=,
container_query(name : String) : self
container_query,
container_query_name : String | Nil
container_query_name,
container_query_name=(container_query_name : String | Nil)
container_query_name=,
corner_radius : Float64
corner_radius,
corner_radius=(corner_radius : Float64)
corner_radius=,
fill_screen! : self
fill_screen!,
fluid_height(min : String | Number, ideal : String | Number, max : String | Number) : selffluid_height : UI::Fluid | Nil fluid_height, fluid_height=(fluid_height : UI::Fluid | Nil) fluid_height=, fluid_width(min : String | Number, ideal : String | Number, max : String | Number) : self
fluid_width : UI::Fluid | Nil fluid_width, fluid_width=(fluid_width : UI::Fluid | Nil) fluid_width=, hidden : Bool hidden, hidden=(hidden : Bool) hidden=, id : String | Nil id, id=(id : String | Nil) id=, maximum_height : Float64 | Nil maximum_height, maximum_height=(maximum_height : Float64 | Nil) maximum_height=, maximum_width : Float64 | Nil maximum_width, maximum_width=(maximum_width : Float64 | Nil) maximum_width=, minimum_height : Float64 | Nil minimum_height, minimum_height=(minimum_height : Float64 | Nil) minimum_height=, minimum_width : Float64 | Nil minimum_width, minimum_width=(minimum_width : Float64 | Nil) minimum_width=, opacity : Float64 opacity, opacity=(opacity : Float64) opacity=, padding : EdgeInsets padding, padding=(padding : EdgeInsets) padding=, root_fill : Bool root_fill, root_fill=(root_fill : Bool) root_fill=, shadow_color : Color | Nil shadow_color, shadow_color=(shadow_color : Color | Nil) shadow_color=, shadow_offset_x : Float64 shadow_offset_x, shadow_offset_x=(shadow_offset_x : Float64) shadow_offset_x=, shadow_offset_y : Float64 shadow_offset_y, shadow_offset_y=(shadow_offset_y : Float64) shadow_offset_y=, shadow_radius : Float64 shadow_radius, shadow_radius=(shadow_radius : Float64) shadow_radius=, swiftkit_state_handle : Pointer(Void) | Nil swiftkit_state_handle, swiftkit_state_handle=(swiftkit_state_handle : Pointer(Void) | Nil) swiftkit_state_handle=, test_id : String | Nil test_id, test_id=(test_id : String | Nil) test_id=
Constructor Detail
Construct a TextField. text: pre-populates the value (useful
when re-rendering a form after a failed submit). name: sets the
HTML form-input name for web POST submission.
Convenience constructor with a change handler block.
Instance Method Detail
Accept a platform visitor for rendering dispatch.
Each concrete view type calls visitor.visit(self).
Name attribute for web POST submission. When non-nil and the
field renders into a <form> (UI::Form), the web renderer emits
name="..." so the browser includes this field in the form-encoded
body. Native renderers ignore this property — they collect field
values via FormState in Phase 8B/8C.
Name attribute for web POST submission. When non-nil and the
field renders into a <form> (UI::Form), the web renderer emits
name="..." so the browser includes this field in the form-encoded
body. Native renderers ignore this property — they collect field
values via FormState in Phase 8B/8C.
Callback invoked when the text value changes. Receives the new text string.
Callback invoked when the text value changes. Receives the new text string.