You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.9 KiB

4 years ago
  1. +++
  2. title = "Text Input"
  3. description = "Add a single-line plain-text editing control."
  4. categories = ["experience"]
  5. tags = ["controls"]
  6. html_attributes = ["id", "name", "class", "autocomplete", "autofocus", "disabled", "form", "formaction", "formmethod", "formtarget", "height", "max", "maxlength", "min", "minlength", "multiple", "pattern", "placeholder", "readonly", "required", "size", "spellcheck", "step", "tabindex", "type", "value", "width"]
  7. custom_attributes = []
  8. snippets_used = ["text input", "label", "form group", "form", "help block"]
  9. [[copyright]]
  10. owner = "Josh Habdas"
  11. date = "2019"
  12. license = "agpl-3.0-or-later"
  13. +++
  14. Basic usage:
  15. ```html
  16. {{</* hackcss-textinput */>}}
  17. {{</* hackcss-textinput type="password" */>}}
  18. {{</* hackcss-textinput type="email" placeholder="Please enter your email…" */>}}
  19. {{</* hackcss-textinput disabled="true" placeholder="Disabled" */>}}
  20. ```
  21. {{< hackcss-textinput >}}
  22. {{< hackcss-textinput type="password" >}}
  23. {{< hackcss-textinput type="email" placeholder="Please enter your email…" >}}
  24. {{< hackcss-textinput disabled="true" placeholder="Disabled" >}}
  25. With [Label](../label) and [Help Block](../help-block) in [Form](../form) with custom validation:
  26. ```html
  27. {{</* hackcss-form >}}
  28. {{< hackcss-label >}}
  29. {{< hackcss-helpblock text="Enter your Associate Tag:" />}}
  30. {{< hackcss-textinput name="AssociateTag" required="true" pattern="^\b\w*\b-20$" placeholder="associate-20" >}}
  31. {{< /hackcss-label >}}
  32. {{< /hackcss-form */>}}
  33. ```
  34. {{< hackcss-form >}}
  35. {{< hackcss-label >}}
  36. {{< hackcss-helpblock text="Enter your Associate Tag:" />}}
  37. {{< hackcss-textinput name="AssociateTag" required="true" pattern="^\b\w*\b-20$" placeholder="associate-20" >}}
  38. {{< /hackcss-label >}}
  39. {{< /hackcss-form >}}
  40. In [Form Group](../form-group) with warning [Label](../label) and [Help Block](../help-block):
  41. ```html
  42. {{</* hackcss-formgroup state="warning" >}}
  43. {{< hackcss-label for="key64" text="64-bit PGP key:" />}}
  44. {{< hackcss-textinput spellcheck="false" type="text" id="key64" >}}
  45. {{< hackcss-helpblock text="In this format: BB73 67EE 9A70 A631" />}}
  46. {{< /hackcss-formgroup */>}}
  47. ```
  48. {{< hackcss-formgroup state="warning" >}}
  49. {{< hackcss-label for="key64" text="64-bit PGP key:" />}}
  50. {{< hackcss-textinput spellcheck="false" type="text" id="key64" >}}
  51. {{< hackcss-helpblock text="In this format: BB73 67EE 9A70 A631" />}}
  52. {{< /hackcss-formgroup >}}
  53. Typed with [Label](../label) in [Form Group](../form-group) targeting [Form](../form) owner:
  54. ```html
  55. {{</* hackcss-form id="search" action="/search" /*/>}}
  56. {{</* hackcss-formgroup >}}
  57. {{< hackcss-label for="query" text="Search query:" />}}
  58. {{< hackcss-textinput type="search" id="query" form="search" >}}
  59. {{< /hackcss-formgroup */>}}
  60. ```
  61. {{< hackcss-form id="search" action="/search" />}}
  62. {{< hackcss-formgroup >}}
  63. {{< hackcss-label for="query" text="Search query:" />}}
  64. {{< hackcss-textinput type="search" id="query" name="s" form="search" >}}
  65. {{< /hackcss-formgroup >}}