Input

public struct Input: Html

A wrapper for the HTML ‘input’ element.

  • The different types of ‘input’.

    See more

    Declaration

    Swift

    public enum `Type`: String
  • The content for the name attribute

    Declaration

    Swift

    public var name: String?
  • The content for the value attribute

    Declaration

    Swift

    public var value: String?
  • The content for the onclick attribute

    Declaration

    Swift

    public var onclick: String?
  • When true, the checked attribute will be included

    Declaration

    Swift

    public var checked: Bool = false
  • When true, the readonly attribute will be included

    Declaration

    Swift

    public var readonly: Bool = false
  • When true, the disabled attribute will be included

    Declaration

    Swift

    public var disabled: Bool = false
  • The value for the size attribute. The size attribute is only included when a value has been assigned.

    Declaration

    Swift

    public var size: Int?
  • The value for the maxlength attribute. The maxlength attribute is only included when a value has been assigned.

    Declaration

    Swift

    public var maxlength: Int?
  • The HTML string generated for the content of this element.

    Declaration

    Swift

    public var html: String
  • Create a new ‘input’ element.

    Declaration

    Swift

    public init(_ type: Type, _ klass: [String], _ id: String?)

    Parameters

    klass

    The CSS class names that configure this element

    id

    The CSS id name that configure this element

    content

    The content for this element

  • Create a new ‘input’ element of the ‘text’ type.

    Declaration

    Swift

    public static func text(klass: [String] = [], name: String, value: String? = nil) -> Input

    Parameters

    klass

    (Optional) The CSS class names that configure this element

    name

    The value for the name attribute

    value

    (Optional) The value for the value attribute

  • Create a new ‘input’ element of the ‘text’ type.

    Declaration

    Swift

    public static func text(klass: String, name: String, value: String? = nil) -> Input

    Parameters

    klass

    The CSS class name that configures this element

    name

    The value for the name attribute

    value

    (Optional) The value for the value attribute

  • Create a new ‘input’ element of the ‘text’ type.

    Declaration

    Swift

    public static func text(id: String, name: String, value: String? = nil) -> Input

    Parameters

    id

    The CSS id name that configures this element

    name

    The value for the name attribute

    value

    (Optional) The value for the value attribute

  • Create a new ‘input’ element of the ‘password’ type.

    Declaration

    Swift

    public static func password(klass: [String] = [], name: String, value: String? = nil) -> Input

    Parameters

    klass

    The CSS class names that configure this element

    name

    The value for the name attribute

    value

    (Optional) The value for the value attribute

  • Create a new ‘input’ element of the ‘password’ type.

    Declaration

    Swift

    public static func password(klass: String, name: String, value: String? = nil) -> Input

    Parameters

    klass

    The CSS class name that configures this element

    name

    The value for the name attribute

    value

    (Optional) The value for the value attribute

  • Create a new ‘input’ element of the ‘password’ type.

    Declaration

    Swift

    public static func password(id: String, name: String, value: String? = nil) -> Input

    Parameters

    id

    The CSS id name that configures this element

    name

    The value for the name attribute

    value

    (Optional) The value for the value attribute

  • Create a new ‘input’ element of the ‘submit’ type.

    Declaration

    Swift

    public static func submit(klass: [String] = [], name: String? = nil, title: String) -> Input

    Parameters

    klass

    (Optional) The CSS class names that configure this element

    name

    (Optional) The value for the name attribute

    title

    The value for the value attribute

  • Create a new ‘input’ element of the ‘submit’ type.

    Declaration

    Swift

    public static func submit(klass: String, name: String? = nil, title: String) -> Input

    Parameters

    klass

    The CSS class name that configures this element

    name

    (Optional) The value for the name attribute

    title

    The value for the value attribute

  • Create a new ‘input’ element of the ‘submit’ type.

    Declaration

    Swift

    public static func submit(id: String, name: String? = nil, title: String) -> Input

    Parameters

    id

    The CSS id name that configures this element

    name

    (Optional) The value for the name attribute

    title

    The value for the value attribute

  • Create a new ‘input’ element of the ‘checkbox’ type.

    Declaration

    Swift

    public static func checkbox(klass: [String] = [], name: String, value: String, checked: Bool) -> Input

    Parameters

    klass

    (Optional) The CSS class names that configure this element

    name

    The value for the name attribute

    value

    The value for the value attribute

    checked

    If true, the checkbox will initially be ‘checked’

  • Create a new ‘input’ element of the ‘checkbox’ type.

    Declaration

    Swift

    public static func checkbox(klass: String, name: String, value: String, checked: Bool) -> Input

    Parameters

    klass

    The CSS class name that configures this element

    name

    The value for the name attribute

    value

    The value for the value attribute

    checked

    If true, the checkbox will initially be ‘checked’

  • Create a new ‘input’ element of the ‘checkbox’ type.

    Declaration

    Swift

    public static func checkbox(id: String, name: String, value: String, checked: Bool) -> Input

    Parameters

    id

    The CSS id name that configures this element

    name

    The value for the name attribute

    value

    The value for the value attribute

    checked

    If true, the checkbox will initially be ‘checked’

  • Create a new ‘input’ element of the ‘hidden’ type.

    Declaration

    Swift

    public static func hidden(name: String, value: String) -> Input

    Parameters

    name

    The value for the name attribute

    value

    The value for the value attribute

  • Create a new ‘input’ element of the ‘reset’ type.

    Declaration

    Swift

    public static func reset() -> Input
  • Create a new ‘input’ element of the ‘button’ type.

    Declaration

    Swift

    public static func button(klass: [String] = [], name: String? = nil, title: String) -> Input

    Parameters

    klass

    (Optional) The CSS class names that configure this element

    name

    (Optional) The value for the name attribute

    title

    The value for the value attribute

  • Create a new ‘input’ element of the ‘button’ type.

    Declaration

    Swift

    public static func button(klass: String, name: String? = nil, title: String) -> Input

    Parameters

    klass

    The CSS class name that configures this element

    name

    (Optional) The value for the name attribute

    title

    The value for the value attribute

  • Create a new ‘input’ element of the ‘button’ type.

    Declaration

    Swift

    public static func button(id: String, name: String? = nil, title: String) -> Input

    Parameters

    id

    The CSS id name that configures this element

    name

    (Optional) The value for the name attribute

    title

    The value for the value attribute

  • Create a new ‘input’ element of the ‘radio’ type.

    Declaration

    Swift

    public static func radio(klass: [String] = [], name: String, value: String, checked: Bool) -> Input

    Parameters

    klass

    (Optional) The CSS class names that configure this element

    name

    The value for the name attribute

    value

    The value for the value attribute

    checked

    If true, the radio will initially be ‘selected’

  • Create a new ‘input’ element of the ‘radio’ type.

    Declaration

    Swift

    public static func radio(klass: String, name: String, value: String, checked: Bool) -> Input

    Parameters

    klass

    The CSS class name that configures this element

    name

    The value for the name attribute

    value

    The value for the value attribute

    checked

    If true, the radio will initially be ‘selected’

  • Create a new ‘input’ element of the ‘radio’ type.

    Declaration

    Swift

    public static func radio(id: String, name: String, value: String, checked: Bool) -> Input

    Parameters

    id

    The CSS id name that configures this element

    name

    The value for the name attribute

    value

    The value for the value attribute

    checked

    If true, the radio will initially be ‘selected’