Skip to content

Text Input

Text Input Component

The Text Input component provides a styled input field that maintains consistent appearance and behavior across the application.

Example

Usage

import TextInput from "@altitude/ui/react/ui/text-input";
export default function InputExample() {
const [value, setValue] = React.useState("");
const handleChange = (e) => {
setValue(e.target.value);
};
return (
<div>
{/* Basic text input */}
<TextInput placeholder="Enter your name" />
{/* Input with type and validation */}
<TextInput type="email" placeholder="Enter your email" required />
{/* Controlled input */}
<TextInput
value={value}
onChange={handleChange}
placeholder="Type something..."
/>
</div>
);
}

Props

The Text Input component accepts all standard HTML input attributes:

PropTypeRequiredDescription
typestringNoInput type (e.g., “text”, “email”, “password”) (default: “text”)
placeholderstringNoPlaceholder text
valuestringNoControlled input value
defaultValuestringNoDefault value for uncontrolled input
disabledbooleanNoWhether the input is disabled
requiredbooleanNoWhether the input is required
aria-invalidbooleanNoWhether the input has an error
classNamestringNoAdditional CSS classes
onChangefunctionNoHandler for input changes

All other standard HTML input attributes are also supported.

Notes

This is a base UI component that provides styling but no built-in validation or labeling. For a complete form field with label, helper text, and validation, consider using the Text Input Field component.