html_dsl/types/html/form
Types
An enum of all possible input types for an HTML input element.
pub type InputType {
Button
Checkbox
Color
Date
DatetimeLocal
Email
File
Hidden
Image
Month
Number
Password
Radio
Range
Reset
Search
Submit
Tel
Text
Time
Url
Week
}
Constructors
-
Button -
Checkbox -
Color -
Date -
DatetimeLocal -
Email -
File -
Hidden -
Image -
Month -
Number -
Password -
Radio -
Range -
Reset -
Search -
Submit -
Tel -
Text -
Time -
Url -
Week
Functions
pub fn element(
root root: Input,
content content: String,
) -> Input
This function is used to create an Element
@paramroot: The root of the element@paramcontent: The content of the element@returns: An Element
pub fn end(root: Input) -> String
Ends form context
@paramroot: The root of the form@returns: The string representation of the form
pub fn form(attributes attributes: Option(Attribute)) -> Input
This creates a string that represents a form element
@paramattributes: The attributes of the element@returns: A string that represents the HTML element
pub fn input(
root root: Input,
attributes attributes: Option(Attribute),
input_type input_type: InputType,
placeholder placeholder: String,
) -> Input
This creates a string that represents an input element
@paramroot: The root of the element@paramattributes: The attributes of the element@paraminput_type: The type of the input@paramplaceholder: The placeholder of the input@returns: An Input
pub fn input_to_string(input: Input) -> String
This function converts an Input to a string
@paraminput: The input to convert@returns: The string representation of the input
pub fn input_type_to_attribute(input_type: InputType) -> String
A function that converts an input type to the corresponding HTML attribute as a string.
@paraminput_type: The input type to convert.@return: The corresponding HTML attribute as a string. @example
let str = input_type_to_attribute(InputType.Text)
// str == "type=\"text\""
pub fn label(
root root: Input,
attributes attributes: Option(Attribute),
innner inner: String,
) -> Input
This creates a string that represents a label element
@paramroot: The root of the element@paramattributes: The attributes of the element@paraminner: The child of the element@returns: An Input