UI.MD

Input

A text input field with optional start/end icon decoration and an interactive in-field action slot.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/input.json

Usage

import { Input } from "@/components/ui/input"

Examples

Default

Sizes

Heights are 24/28/32/40, the same ramp and the same names as Button, so passing the same size to a field and the button beside it gives one height and one corner radius. The pair at the bottom is the case this exists for: a form control used to sit a tier squarer than an action, which read as a mistake the moment the two were stacked at the same width.

With Icons

iconStart and iconEnd render decorative, non-interactive icons inside the field.

With Action

actionEnd renders an interactive control inside the field: a copy, clear, or reveal-password button. Pass an icon-sm Button.

API Reference

PropTypeDefaultDescription
variant"default" | "ghost""default"default is the bordered form field. ghost is borderless and transparent with no forced height or font-size and minimal focus, for title composers and inline-edit fields; size it via className.
size"xs" | "sm" | "default" | "lg""default"Control height (24/28/32/40), using Button's size names so the same size on a field and the button beside it gives the same height and the same corner radius. Height, side padding, and radius move together. Ignored by ghost, which has no chrome. Note this REPLACES the native HTML size attribute, which sets character width and is superseded by className="w-*".
iconStartLucideIcon-Decorative, non-interactive icon rendered at the leading edge of the field. Pass the component itself (Search), not an element.
iconEndLucideIcon-Decorative, non-interactive icon rendered at the trailing edge of the field. Pass the component itself (Mail), not an element.
actionEndReact.ReactNode-Interactive element rendered inside the field at the trailing edge: a copy, clear, or reveal-password button. Pass an icon-sm Button.
classNamestring-Applied to the input itself, or to the wrapper div when any icon/action adornment is present.