Text Field
A single-line text field with a placeholder and optional leading icon.
| Prop | Type | Default | Notes |
|---|---|---|---|
name |
String | nil |
input `name` attribute. |
value |
String | nil |
input value. |
placeholder |
String | nil |
placeholder text. |
type |
String | "text" |
input type — "text" (default), "email", "password", … |
disabled |
Boolean | false |
disables the input. |
icon |
String | nil |
optional leading icon name (see IconComponent). |
**html_options |
Hash | — | extra HTML attributes (id, data-*, aria-*, class, …). |
Default
1 | <%= render TextFieldComponent.new(placeholder: "Text") %> |
Disabled
1 | <%= render TextFieldComponent.new(placeholder: "Text", disabled: true) %> |
With icon
1 | <%= render TextFieldComponent.new(placeholder: "Search", icon: "magnifying-glass") %> |
With value
1 | <%= render TextFieldComponent.new(value: "siddhartharun@gist.so") %> |