Forms and Inputs
lui supports <input> (22 types), <textarea>, <button>, and <select>, with full text editing, caret navigation, and selection.
Text Inputs
<input type="text">, <input type="password">, <input type="email">, <input type="number">, <input type="search">, <input type="tel">, <input type="url">:
- Single-line editing with keyboard navigation (arrow keys, Home, End)
- Shift-selection for range selection
- Click to place caret, drag to select
- Placeholder text when empty
- Clipboard: Ctrl+C copy, Ctrl+X cut, Ctrl+V paste
<input type="password">: masked with U+2022 bullets- Readonly support:
readonlyattribute prevents editing - Disabled support:
disabledattribute +:disabledpseudo-class
Checkboxes and Radios
<input type="checkbox"> and <input type="radio">:
- Native GPU-rendered checkmark (checkbox) and dot (radio)
- Checked/unchecked visual state,
border, andaccent-colorsupport - Click to toggle, fires
changeandinputevents - Radio mutual exclusion within same
namegroup checkedattribute for initial state
Range Slider
<input type="range">:
- Native GPU-rendered track with filled portion and thumb
min,max,value, andstepattributes- Drag thumb to adjust value
- Customizable via CSS:
--lui-range-track-color,--lui-range-progress-color,--lui-range-thumb-color,--lui-range-thumb-shadow - Default
height: 16px
Color Picker
<input type="color">:
- Native color swatch with inset border
- Full color picker overlay rendered through the layout/paint pipeline
- Gradient bars for hue and alpha selection
- Editable hex and RGBA text fields
- Configurable via
--lui-color-*CSS custom properties valueattribute as hex color string
Date Inputs
<input type="date"> and <input type="datetime-local">:
- Locale-formatted date display (DMY, MDY, YMD patterns)
- Per-segment editing in overwrite mode
- Tab navigation between segments
- Calendar picker overlay with header, grid, and hover/focus states
min,max,step,value(ISO 8601 format)- Configurable via
--lui-calendar-*CSS properties (~28 properties) datetime-localadds HH:MM time segments with validation on blur- Pluggable
Localetrait for date patterns and month/weekday names
File Input
<input type="file">:
- Native file dialog via rfd backend
acceptattribute for file type filteringmultipleattribute for multi-file selection- File info stored: name, size (bytes), MIME type, path, last modified
- Label displays selected filenames
::file-selector-buttonpseudo-element for button styling
Textarea
<textarea>:
- Multiline text editing with full keyboard support
overflow: autowith scrollbars when content exceeds box- Placeholder text when empty
resizeproperty (both,none,horizontal,vertical)white-space: pre-wrap, monospace fontrowsandcolsattributes for initial size
Buttons
<input type="submit">, <input type="reset">, <input type="button">, <button>:
- Styled with button-like appearance (inset/outset border, buttonface background)
<button>renders child content;<input>buttons show value as text- Focusable with keyboard navigation
Submitbutton: firessubmitevent on Enter or clickResetbutton: resets form controls
Select
<select> with <option> and <optgroup>:
- Parsed with full attribute support (
multiple,size,required,disabled) - Styled as inline-block with border and padding
- No popup/list interaction yet — rendered as static box showing text content
selected,value,labelattributes parsed
Form Submission
Forms with a submit button or text input support the standard submission flow:
<form id="login" method="post">
<input type="text" name="username" value="alice">
<input type="password" name="password">
<input type="checkbox" name="remember" checked>
<input type="submit" value="Log in">
</form>
Triggers:
- Click on
<input type="submit">or<button type="submit"> - Enter key in a text/password/email input inside a form
- Space/Enter on a focused submit button
Flow:
SubmitEventfires on the form with capture → target → bubble phases- If
preventDefault()is called, form data collection is skipped - Otherwise,
collect_form_datawalks the form subtree and collectsname+valuepairs from:<input>(text, password, email, number, search, tel, url, checkbox checked, radio checked, date, datetime-local, color, range, hidden, file)<textarea>(text content)- Excludes: unchecked checkboxes/radios, submit/reset/button inputs, image inputs
FormDataEventfires on the form with aFormDataIdhandle- Host retrieves data via
Tree::take_form_data(FormDataId)→Vec<FormField>
Rust API:
// Programmatic submission
lui_tree::submit_form(&mut tree, form_path, Some(submitter_path));
// Retrieve collected data
let fields: Vec<FormField> = tree.take_form_data(form_data_id).unwrap();
// fields[0].name, fields[0].value — ArcStr
Not yet implemented: pattern regex validation, form.action/method URL construction, multipart/form-data encoding.