Class TextInput

java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.components.forms.TextInput
All Implemented Interfaces:
Component

public class TextInput extends HtmlTag
Single-line input control.

Mutable and not thread-safe. Mutators update this element instance in place. Mutate within a request-scoped flow. For reuse, stop mutating and render as a stable structure with per-request slot/context values.

  • Constructor Details

    • TextInput

      public TextInput(String name)
      Creates a text input with default type text.
      Parameters:
      name - form field name
  • Method Details

    • create

      public static TextInput create(String name)
      Creates a text input.
      Parameters:
      name - form field name
      Returns:
      new input
    • email

      public static TextInput email(String name)
      Creates an email input.
      Parameters:
      name - form field name
      Returns:
      new input configured as email
    • password

      public static TextInput password(String name)
      Creates a password input.
      Parameters:
      name - form field name
      Returns:
      new input configured as password
    • number

      public static TextInput number(String name)
      Creates a number input.
      Parameters:
      name - form field name
      Returns:
      new input configured as number
    • date

      public static TextInput date(String name)
      Creates a date input.
      Parameters:
      name - form field name
      Returns:
      new input configured as date
    • search

      public static TextInput search(String name)
      Creates a search input.
      Parameters:
      name - form field name
      Returns:
      new input configured as search
    • withType

      public TextInput withType(TextInput.InputType type)
      Sets input type.
      Parameters:
      type - input type enum
      Returns:
      this input
    • withId

      public TextInput withId(String id)
      Sets id attribute.
      Overrides:
      withId in class HtmlTag
      Parameters:
      id - element id
      Returns:
      this input
    • withValue

      public TextInput withValue(String value)
      Sets value attribute.
      Parameters:
      value - input value
      Returns:
      this input
    • withPlaceholder

      public TextInput withPlaceholder(String placeholder)
      Sets placeholder attribute.
      Parameters:
      placeholder - placeholder text
      Returns:
      this input
    • required

      public TextInput required()
      Marks input required.
      Returns:
      this input
    • readonly

      public TextInput readonly()
      Marks input readonly.
      Returns:
      this input
    • disabled

      public TextInput disabled()
      Marks input disabled.
      Returns:
      this input
    • withPattern

      public TextInput withPattern(String pattern)
      Sets HTML pattern.
      Parameters:
      pattern - regex pattern
      Returns:
      this input
    • withMinLength

      public TextInput withMinLength(int minLength)
      Sets minimum text length.
      Parameters:
      minLength - minimum length
      Returns:
      this input
    • withMaxLength

      public TextInput withMaxLength(int maxLength)
      Sets maximum text length.
      Parameters:
      maxLength - maximum length
      Returns:
      this input
    • withMin

      public TextInput withMin(String min)
      Sets HTML min value.
      Parameters:
      min - minimum value token
      Returns:
      this input
    • withMax

      public TextInput withMax(String max)
      Sets HTML max value.
      Parameters:
      max - maximum value token
      Returns:
      this input
    • withStep

      public TextInput withStep(String step)
      Sets HTML step.
      Parameters:
      step - step token
      Returns:
      this input
    • withClass

      public TextInput withClass(String className)
      Appends class token(s).
      Overrides:
      withClass in class HtmlTag
      Parameters:
      className - class token(s)
      Returns:
      this input
    • withAutofocus

      public TextInput withAutofocus()
      Sets autofocus attribute.
      Returns:
      this input
    • withAutocomplete

      public TextInput withAutocomplete(String value)
      Sets autocomplete attribute.
      Parameters:
      value - autocomplete value
      Returns:
      this input
    • withWidth

      public TextInput withWidth(String width)
      Sets inline width style.
      Overrides:
      withWidth in class HtmlTag
      Parameters:
      width - CSS width value
      Returns:
      this input
    • withMaxWidth

      public TextInput withMaxWidth(String maxWidth)
      Sets inline max-width style.
      Overrides:
      withMaxWidth in class HtmlTag
      Parameters:
      maxWidth - CSS max-width value
      Returns:
      this input
    • withMinWidth

      public TextInput withMinWidth(String minWidth)
      Sets inline min-width style.
      Overrides:
      withMinWidth in class HtmlTag
      Parameters:
      minWidth - CSS min-width value
      Returns:
      this input