Input
Native single-line input.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_input name: "title", placeholder: "Small", size: :sm, class: "max-w-sm", aria: { label: "Small input" } %>
<%= lc_input name: "title", placeholder: "Default", class: "max-w-sm", aria: { label: "Default input" } %>
<%= lc_input name: "title", placeholder: "Large", size: :lg, class: "max-w-sm", aria: { label: "Large input" } %>
Examples
Sizes
<%= lc_input name: "title", placeholder: "Small", size: :sm, class: "max-w-sm", aria: { label: "Small input" } %>
<%= lc_input name: "title", placeholder: "Default", class: "max-w-sm", aria: { label: "Default input" } %>
<%= lc_input name: "title", placeholder: "Large", size: :lg, class: "max-w-sm", aria: { label: "Large input" } %>
Disabled and read-only
<%= lc_input value: "Read-only value", readonly: true, class: "max-w-sm", aria: { label: "Read-only input" } %>
<%= lc_input placeholder: "Disabled", disabled: true, class: "max-w-sm", aria: { label: "Disabled input" } %>
Leading icon
<%= lc_input type: :search, icon: "magnifying-glass", name: "q", placeholder: "Search currencies", class: "max-w-sm rounded-full", aria: { label: "Search currencies" } %>
API reference
Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.
lc_input
lc_input(name: nil, value: nil, type: :text, size: :md, plain: false, icon: nil, **attributes)
| Input | Default | Values |
|---|---|---|
| name | nil | — |
| value | nil | — |
| type | :text | :text · :search · :email · :password · :tel · :url · :number · :date · :time · :datetime-local · :month · :week |
| size | :md | :sm · :md · :lg |
| plain | false | true · false |
| icon | nil | Heroicon name; spacing is handled automatically |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
Styling and extension
Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.