Blocks

Input

A single-line text field. Thin wrapper around the HTML <input> element with consistent styling.

Usage

sui.input placeholder: "Type something…"

Disabled

sui.input placeholder: "Disabled", disabled: true

Types

sui.input type: "email", placeholder: "[email protected]"
sui.input type: "password", placeholder: "••••••••"
sui.input type: "number", placeholder: "42"

With label

tag.div(class: "space-y-2") do
  sui.label("Email", for_id: "email") +
  sui.input(type: "email", id: "email", placeholder: "[email protected]")
end

Full form field pattern

tag.div(class: "space-y-4 w-80") do
  tag.div(class: "space-y-2") do
    sui.label("Username", for_id: "username") +
    sui.input(id: "username", placeholder: "johndoe")
  end +
  tag.div(class: "space-y-2") do
    sui.label("Password", for_id: "password") +
    sui.input(type: "password", id: "password", placeholder: "••••••••")
  end +
  sui.button("Sign in", class: "w-full")
end

API

name type default description
typeString"text"HTML input type. Any valid value: email, password, number, file, etc.
placeholderStringnilPlaceholder text shown when the field is empty.
disabledBooleanfalseDisables the field; applies muted styling via disabled:opacity-50.
idStringnilSets the element id; used with sui.label for_id: to link label and input.
**optsHashAny additional HTML attribute (name, value, autofocus, data-*, …).