Input

A React text input with a built in label, hint, and inline error wired to screen readers, plus leading and trailing icons and a one tap clear button.

Loading preview

Examples

Practical examples and common states for the same installable component.

Label

Standard labeled field for forms and settings.

examples/input-label.tsx
import { IconMail } from "@tabler/icons-react";
import { Input } from "@/components/wensity/input";
export function InputLabel() {
return (
<Input
label="Email"
placeholder="you@company.com"
leftIcon={<IconMail />}
/>
);
}

Error

Validation errors update border, focus ring, and accessibility state.

examples/input-error.tsx
import { IconMail } from "@tabler/icons-react";
import { Input } from "@/components/wensity/input";
export function InputError() {
return (
<Input
label="Email"
defaultValue="hello@"
error="Enter a complete email address."
leftIcon={<IconMail />}
/>
);
}

Icons

Left and right slots keep dense form rows easy to scan.

examples/input-icons.tsx
import { IconLock, IconUser } from "@tabler/icons-react";
import { Input } from "@/components/wensity/input";
export function InputIcons() {
return (
<div className="space-y-4">
<Input
label="Display name"
autoComplete="name"
placeholder="Parth Sharma"
leftIcon={<IconUser />}
/>
<Input
label="Password"
type="password"
autoComplete="current-password"
placeholder="Enter password"
leftIcon={<IconLock />}
/>
</div>
);
}

Clearable

Controlled clear action keeps focus in the field after reset.

examples/input-clearable.tsx
"use client";
import * as React from "react";
import { Input } from "@/components/wensity/input";
export function InputClearable() {
const [value, setValue] = React.useState("Quarterly roadmap");
return (
<Input
label="Project"
value={value}
onChange={(event) => setValue(event.target.value)}
onClear={() => setValue("")}
clearable
/>
);
}

Read-only

Read-only values stay selectable while reducing emphasis.

examples/input-readonly.tsx
import { Input } from "@/components/wensity/input";
export function InputReadonly() {
return <Input label="API endpoint" value="https://api.wensity.com/v1" readOnly />;
}

Disabled

Disabled state blocks interaction while keeping layout stable.

examples/input-disabled.tsx
import { IconMail } from "@tabler/icons-react";
import { Input } from "@/components/wensity/input";
export function InputDisabled() {
return (
<Input
label="Billing email"
placeholder="billing@company.com"
defaultValue="billing@acme.com"
disabled
leftIcon={<IconMail />}
/>
);
}

Form

Stack labeled fields with icons and helper copy for compact settings or onboarding flows.

examples/input-form.tsx
import { IconAt, IconMail, IconUser } from "@tabler/icons-react";
import { Input } from "@/components/wensity/input";
export function InputForm() {
return (
<div className="space-y-4">
<Input
label="Full name"
placeholder="Parth Kumar"
leftIcon={<IconUser />}
/>
<Input
label="Work email"
type="email"
placeholder="you@company.com"
leftIcon={<IconMail />}
/>
<Input
label="Workspace slug"
placeholder="acme"
hint="Letters, numbers, and hyphens only."
leftIcon={<IconAt />}
/>
</div>
);
}

Overview

Input is a React and Tailwind CSS text input with a built in label, hint, and error message, in Next.js or any React app. Pass error and the field turns red, sets aria-invalid, and links the message through aria-describedby, so screen readers read it together with the field. Leading and trailing icon slots sit inside the border, and clearable adds an X button that empties the value and puts focus back in the field. It works controlled or uncontrolled, in sm, md, and lg heights. While text is present, the clear button takes the place of the right icon.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add input

Usage

Import Input from @/components/wensity/input and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { IconMail } from "@tabler/icons-react";
import { Input } from "@/components/wensity/input";
export function InputDemo() {
return (
<Input
label="Email"
placeholder="you@company.com"
leftIcon={<IconMail />}
/>
);
}

Props

PropTypeDefaultDescription
labelReact.ReactNode-Field label rendered above the control and wired to it for accessibility.
hintReact.ReactNode-Helper copy under the field. Hidden while error is set.
errorReact.ReactNode-Error message under the field, with invalid styling applied.
inputSize"sm" | "md" | "lg""md"Control height and text size. Named inputSize because size is a native attribute.
leftIconReact.ReactNode-Icon rendered inside the field on the leading edge.
rightIconReact.ReactNode-Icon rendered inside the field on the trailing edge.
clearablebooleanfalseShows a clear button once the field has a value.
onClear() => void-Called when the clear button is pressed.
fullWidthbooleantrueStretches the field to fill its container.
containerClassNamestring-Classes for the outer wrapper, so layout can be tuned without touching the control.
inputClassNamestring-Classes for the input element itself.
  • AI Prompt Input component preview

    AI Prompt Input

    An expanding prompt area with a glowing drop zone that breathes open to meet you as you type a thought or drag a file.

  • Google-Style Search Bar component preview

    Google-Style Search Bar

    A Google AI Mode search bar with a rainbow that travels the rim, cycling typewriter prompts, and an inline Google wordmark.

  • Multi-Select Tag Input component preview

    Multi-Select Tag Input

    A tag input where pills pop in as you add them and slide out on remove, closing the gap without snapping the layout.

  • Gooey Search Bar component preview

    Gooey Search Bar

    A search circle stretches into a field, and results drip out below it. Ask Claude, ChatGPT, or Google in one keystroke.