pub enum InputType {
Show 22 variants
Text,
Password,
Email,
Url,
Tel,
Number,
Range,
Date,
Time,
DatetimeLocal,
Month,
Week,
Color,
Checkbox,
Radio,
File,
Submit,
Reset,
Button,
Image,
Hidden,
Search,
}Expand description
The type attribute values for <input> elements.
§Purpose
Defines the type of input control, determining the behavior, validation, and user interface for collecting user input in forms.
§Usage Context
- Used with:
<input>elements only - Default:
textif not specified - Validation: Many types provide built-in validation (email, url, number)
- Mobile UX: Types affect virtual keyboard layout on mobile devices
§Valid Values
Text: Single-line text inputPassword: Password input (characters obscured)Email: Email address with validationUrl: URL with validationTel: Telephone numberNumber: Numeric input with spinner controlsRange: Slider control for numeric rangeDate: Date pickerTime: Time pickerDatetimeLocal: Date and time picker (no timezone)Month: Month and year pickerWeek: Week and year pickerColor: Color pickerCheckbox: Checkbox for boolean valuesRadio: Radio button for single selection from groupFile: File upload controlSubmit: Submit button for formsReset: Reset button to clear formButton: Generic button (no default behavior)Image: Graphical submit buttonHidden: Hidden input (not displayed)Search: Search input with platform-specific styling
§Example
use ironhtml_attributes::{AttributeValue, InputType};
let input_type = InputType::Email;
assert_eq!(input_type.to_attr_value(), "email");<input type="text" placeholder="Name">
<input type="email" placeholder="user@example.com">
<input type="password" placeholder="Password">
<input type="number" min="0" max="100">
<input type="date">
<input type="checkbox" id="agree">
<input type="submit" value="Submit">§WHATWG Specification
Variants§
Text
Single-line text input. Default type if not specified.
Password
Password input where characters are obscured for security.
Email address input with built-in validation.
Url
URL input with validation for proper URL format.
Tel
Telephone number input. Mobile devices show numeric keyboard.
Number
Numeric input with optional min, max, and step constraints.
Range
Slider control for selecting from a numeric range.
Date
Date picker control (year, month, day).
Time
Time picker control (hours and minutes).
DatetimeLocal
Date and time picker without timezone information.
Month
Month and year picker control.
Week
Week and year picker control.
Color
Color picker returning a hex color value.
Checkbox
Checkbox for boolean or multi-selection inputs.
Radio
Radio button for single selection from a group.
File
File upload control with optional accept and multiple attributes.
Submit
Submit button that submits the form.
Reset
Reset button that clears the form to default values.
Button
Generic button with no default behavior (use with JavaScript).
Image
Image-based submit button with click coordinates.
Hidden
Hidden input not displayed to users but submitted with form.
Search
Search input with platform-specific search styling.