Hero UI Form components (Input, TextField, Checkbox, RadioGroup, Select, TextArea, etc). Use when building forms, handling user input, validation in UniManage with Hero UI v3. Full docs at https://v3.heroui.com/docs/react/components
Complete guide for Hero UI Form components. For detailed examples, visit the official documentation links below.
Docs: https://v3.heroui.com/docs/components/input
Import: import { Input } from '@heroui/react';
Primitive single-line text input accepting standard HTML attributes.
type: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' (default: 'text')value / defaultValue: Controlled/uncontrolled valueonChange: (e: ChangeEvent<HTMLInputElement>) => voidplaceholder, disabled, , readOnlyrequiredmaxLength, minLength, pattern, min, max, stepfullWidth: boolean - Take full widthisOnSurface: boolean - Surface stylingimport { Input } from '@heroui/react';
<Input placeholder="Enter your name" />
<Input type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
<Input type="password" required />
Note: For validation props (isInvalid, isRequired, error messages), use TextField instead.
Docs: https://v3.heroui.com/docs/components/text-field
Import: import { TextField } from '@heroui/react';
Full-featured input with label, validation, and error handling.
label: string - Field labeldescription: string - Helper texterrorMessage: string - Error message to displayisInvalid: boolean - Validation stateisRequired: boolean - Required indicatorimport { TextField } from '@heroui/react';
<TextField
label="Email"
type="email"
required
errorMessage={errors.email}
/>
<TextField
label="Username"
description="Choose a unique username"
isInvalid={!!errors.username}
/>
Docs: https://v3.heroui.com/docs/components/checkbox
Import: import { Checkbox } from '@heroui/react';
import { Checkbox, Label } from "@heroui/react";
<Checkbox>
<Checkbox.Control>
<Checkbox.Indicator />
</Checkbox.Control>
<Label>Accept terms</Label>
</Checkbox>;
// With state
const [checked, setChecked] = useState(false);
<Checkbox checked={checked} onChange={setChecked}>
<Checkbox.Control>
<Checkbox.Indicator />
</Checkbox.Control>
<Label>Subscribe to newsletter</Label>
</Checkbox>;
Docs: https://v3.heroui.com/docs/components/checkbox-group
Import: import { CheckboxGroup } from '@heroui/react';
Group multiple checkboxes with shared state.
<CheckboxGroup value={selected} onChange={setSelected}>
<Checkbox value="option1">
<Label>Option 1</Label>
</Checkbox>
<Checkbox value="option2">
<Label>Option 2</Label>
</Checkbox>
<Checkbox value="option3">
<Label>Option 3</Label>
</Checkbox>
</CheckboxGroup>
Docs: https://v3.heroui.com/docs/components/radio-group
Import: import { RadioGroup, Radio } from '@heroui/react';
Single selection from multiple options.
import { RadioGroup, Radio, Label } from "@heroui/react";
<RadioGroup value={selected} onChange={setSelected}>
<Radio value="option1">
<Label>Option 1</Label>
</Radio>
<Radio value="option2">
<Label>Option 2</Label>
</Radio>
<Radio value="option3">
<Label>Option 3</Label>
</Radio>
</RadioGroup>;
Docs: https://v3.heroui.com/docs/components/select
Import: import { Select } from '@heroui/react';
Dropdown selection with search and filtering.
import { Select } from '@heroui/react';
<Select
label="Country"
placeholder="Select a country"
>
<Select.Item key="us">United States</Select.Item>
<Select.Item key="uk">United Kingdom</Select.Item>
<Select.Item key="ca">Canada</Select.Item>
</Select>
// With state
<Select
selectedKey={country}
onSelectionChange={setCountry}
>
{/* items */}
</Select>
Docs: https://v3.heroui.com/docs/components/combobox
Import: import { ComboBox } from '@heroui/react';
Searchable dropdown with autocomplete.
<ComboBox label="Search users" placeholder="Type to search...">
<ComboBox.Item key="1">John Doe</ComboBox.Item>
<ComboBox.Item key="2">Jane Smith</ComboBox.Item>
</ComboBox>
Docs: https://v3.heroui.com/docs/components/textarea
Import: import { TextArea } from '@heroui/react';
Multi-line text input.
<TextArea label="Description" placeholder="Enter description..." rows={4} maxLength={500} />
Docs: https://v3.heroui.com/docs/components/search-field
Import: import { SearchField } from '@heroui/react';
Specialized input for search functionality.
<SearchField placeholder="Search..." value={query} onChange={setQuery} />
Docs: https://v3.heroui.com/docs/components/number-field
Import: import { NumberField } from '@heroui/react';
Number input with increment/decrement buttons.
<NumberField label="Quantity" min={1} max={100} step={1} value={quantity} onChange={setQuantity} />
Docs: https://v3.heroui.com/docs/components/date-field
Import: import { DateField } from '@heroui/react';
Date input with calendar picker.
<DateField label="Birth Date" value={date} onChange={setDate} />
Docs: https://v3.heroui.com/docs/components/input-otp
Import: import { InputOTP } from '@heroui/react';
One-time password input with multiple boxes.
<InputOTP length={6} value={otp} onChange={setOtp} />
Docs: https://v3.heroui.com/docs/components/form
Import: import { Form } from '@heroui/react';
Form wrapper with validation and submission handling.
<Form onSubmit={handleSubmit}>
<TextField label="Email" name="email" required />
<TextField label="Password" name="password" type="password" required />
<Button type="submit">Submit</Button>
</Form>
<Label htmlFor="email">Email Address</Label>
<Description>Helper text for the field</Description>
<ErrorMessage>{errors.field}</ErrorMessage>
<FieldError name="email">{(error) => error}</FieldError>
<Fieldset>
<legend>Personal Information</legend>
{/* form fields */}
</Fieldset>
import { Form, TextField, Button } from "@heroui/react";
function LoginForm() {
const [formData, setFormData] = useState({ email: "", password: "" });
return (
<Form onSubmit={handleSubmit} className="space-y-4">
<TextField
label="Email"
type="email"
name="email"
required
value={formData.email}
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
/>
<TextField
label="Password"
type="password"
name="password"
required
value={formData.password}
onChange={(e) => setFormData({ ...formData, password: e.target.value })}
/>
<Button type="submit" fullWidth>
Login
</Button>
</Form>
);
}
import { TextField, Button } from "@heroui/react";
function SignupForm() {
const [errors, setErrors] = useState({});
const validate = (data) => {
const errors = {};
if (!data.email.includes("@")) errors.email = "Invalid email";
if (data.password.length < 8) errors.password = "Password too short";
return errors;
};
return (
<form onSubmit={handleSubmit} className="space-y-4">
<TextField
label="Email"
type="email"
isInvalid={!!errors.email}
errorMessage={errors.email}
/>
<TextField
label="Password"
type="password"
isInvalid={!!errors.password}
errorMessage={errors.password}
description="At least 8 characters"
/>
<Button type="submit">Sign Up</Button>
</form>
);
}
errorMessage proprequired proplabel or aria-labeldescription for helper text (announced by screen readers)errorMessage for validation errors<form>, <fieldset>, <legend>)Use this skill when: