Tac UIv1.1.2

Input

A text input field with optional label, helper text, icons, and error state support.

Import

tsx
import { Input } from '@tac-ui/web';

Playground

Interactively configure the Input props below.

tsx
<Input placeholder="Enter text..." />

Sizes

Three size options control the height and font size of the input, matching the Select component scale.

tsx
<Input size="sm" placeholder="Small" />
<Input size="md" placeholder="Medium (default)" />
<Input size="lg" placeholder="Large" />

Default

The base input renders a full-width styled text field with smooth border and shadow transitions on hover and focus.

tsx
<Input placeholder="Enter text..." />

With Icons

Use leftIcon or rightIcon to render an icon inside the input. The icon slot accepts any React node and automatically sizes SVGs to 20px.

tsx
<Input placeholder="Search..." leftIcon={<Search />} />

Password Toggle

Combine rightIcon with an interactive element such as Toggle to build a password visibility toggle without any extra wrapper components.

tsx
const [visible, setVisible] = useState(false);

<Input
  label="Password"
  type={visible ? 'text' : 'password'}
  placeholder="Enter password"
  rightIcon={
    <button onClick={() => setVisible(!visible)}>
      {visible ? <EyeOff /> : <Eye />}
    </button>
  }
/>

With Label and Helper

Pass label to render an associated <label> above the field. helperText appears below when there is no active error.

We'll never share your email.
tsx
<Input label="Email" placeholder="[email protected]" helperText="We'll never share your email." />

Error State

Set error to apply destructive border styling and pass errorMessage to display an accessible error description below the field.

Username is already taken.
tsx
<Input label="Username" placeholder="username" error errorMessage="Username is already taken." />

With Button

rightButton renders a small action button flush inside the right edge of the input, styled automatically to match the input height.

tsx
<Input label="Nickname" placeholder="Enter nickname" rightButton={<button>Check</button>} />

Disabled

The native disabled attribute reduces opacity and blocks all pointer interactions.

tsx
<Input placeholder="Disabled input" disabled />

API Reference

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"Controls the height and font size of the input.
labelstring-Label displayed above the input.
placeholderstring-Placeholder text shown when empty.
helperTextstring-Helper text displayed below the input when there is no error.
errorbooleanfalseApplies error styling when true.
errorMessagestring-Error message displayed when error is true.
leftIconReact.ReactNode-Icon rendered on the left side of the input.
rightIconReact.ReactNode-Icon rendered on the right side of the input.
rightButtonReact.ReactNode-Button element rendered inside the right side of the input.
disabledbooleanfalseDisables the input when true.