Input

A single-line text input field with validation states and placeholder support.

Primitive: TextInput ARIA: role="textbox" Keyboard: Standard text input
input_example.rs
use stratum_leptos::*;

view! {
    <Input placeholder="Enter your email" />
    <Input disabled=true placeholder="Disabled" />
    <Input value="With value" readonly=true />
}

Installation

stratum add input

Input Types

types.rs
<Input input_type=InputType::Text placeholder="Text" />
<Input input_type=InputType::Email placeholder="Email" />
<Input input_type=InputType::Password placeholder="Password" />
<Input input_type=InputType::Search placeholder="Search..." />

Props

PropTypeDefaultDescription
valueOption<String>NoneControlled value
default_valueString""Initial value for uncontrolled usage
placeholderOption<String>NonePlaceholder text
input_typeInputTypeTextInput type: Text, Email, Password, Search, Tel, Url
disabledboolfalsePrevents interaction
readonlyboolfalsePrevents editing but allows focus
requiredboolfalseMarks as required for form validation
on_changeOption<Callback<String>>NoneFires when value is committed (blur/enter)
on_inputOption<Callback<String>>NoneFires on every keystroke
classOption<String>NoneAdditional CSS classes

Accessibility

  • Renders with role="textbox" (or role="searchbox" for Search type).
  • Supports aria-disabled, aria-readonly, aria-required, and aria-placeholder.
  • Label association via aria-labelledby when used inside a FormField.

Source

Primitive: text_input.rs
Styled: input.rs