Menu

Input

Text field with label & helper. 3 styles × 3 sizes × 7 states.

We print this on the parcel.

Installation

$ npx uix-ui@latest add input

This copies the file into components/ui/input.tsx in your project. npx shadcn@latest add @uix/input works too.

Usage

input.tsx
import { Input } from "@/components/ui/input";

<div style={{ width: 320, maxWidth: "100%" }}>
  <Input label="Your name" placeholder="Nusrat Jahan" helper="We print this on the parcel." />
</div>

Examples

Appearances

Sizes

Icon, prefix, error and disabled

Optional
৳BDT

Enter a 4 digit postcode.

Props

PropTypeDefaultDescription
appearanceoutline | filled | underline"outline"
sizesm | md | lg"md"
labelReact.ReactNode–
secondaryLabelReact.ReactNode–Right-aligned note next to the label, for example "Optional".
feedbackReact.ReactNode–Message under the field.
helperReact.ReactNode–Same as feedback.
errorstring–Error message; also marks the field invalid and replaces the feedback.
leadingAvatarReact.ReactNode–Avatar at the start (for example <Avatar size="xs" initials="AB" />).
leadingIconReact.ReactNode–Icon at the start.
leadingContentReact.ReactNode–Selector or text at the start, for example "Email ▾".
leadingDividerboolean–Hairline after the leading parts.
prefixReact.ReactNode–Fixed text before the value, for example "https://".
tagsReact.ReactNode[]–Tag chips before the value.
suffixReact.ReactNode–Fixed text after the value, for example ".com".
trailingDividerboolean–Hairline before the trailing parts.
trailingContentReact.ReactNode–Action at the end, for example a "Copy" button.
helpIconboolean | string–Help icon; a string becomes its accessible name and tooltip.
trailingIconReact.ReactNode–Icon at the end.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close