Components

Input

The shadcn/ui Input with a hover state, softer focus ring, clear invalid state and on-theme autofill — plus five Motion blocks: floating label, password with strength meter, search, one-time code and a shimmering AI prompt field.

  • Drop-in shadcn API
  • Server Component friendly
  • Motion blocks
  • Autofill-safe

Type or paste 123456

Installation

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

Replaces components/ui/input.tsx with the same API. The base Input is CSS-only — no"use client" needed.

Usage

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

export function Newsletter() {
  return <Input type="email" placeholder="you@example.com" aria-label="Email" />
}

Examples

Default

Hover to see the border warm up; focus for the soft ring.

With label & hint

Always pair an input with a <label>, and link hints with aria-describedby.

Visible to everyone in your workspace.

Invalid

Set aria-invalid for the red state. The error message animates its height in and out so the form below doesn't jump.

Disabled, read-only & file

Each native state has its own styling, including a tidy file picker.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

OTP Input

A one-time-code field where the active ring glides between slots, digits fade in and a wrong code shakes. It's one real input under the hood, so paste, SMS autofill (autocomplete="one-time-code") and backspace just work.

Type or paste 123456

$ npx shadcn@latest add https://duskui.com/r/otp-input.json
PropTypeDefaultDescription
lengthnumber6Number of slots.
value / onValueChangestring / (v: string) => void—Controlled value.
onComplete(v: string) => void—Fires once all slots are filled.
invalidbooleanfalseShake and show the error color.
groupSizenumber3Separator every N slots; 0 to hide.
patternstring"[0-9]"Regex for one allowed character.

Floating Label

The label rests inside the field and moves up on focus or once filled — including browser autofill. It's a real <label>, so it stays accessible.

$ npx shadcn@latest add https://duskui.com/r/floating-label-input.json
PropTypeDefaultDescription
labelstring—Label text. Required.

Password Input

Show/hide toggle with a morphing eye icon and an optional four-step strength meter that fills with springs. The scoring helper passwordScore is exported so you can reuse it.

$ npx shadcn@latest add https://duskui.com/r/password-input.json
PropTypeDefaultDescription
showStrengthbooleanfalseRender the strength meter.

Search Input

The search icon turns into a spinner while results load, a clear button fades in once you type, Escape clears, and an optional ⌘ shortcut focuses the field from anywhere.

Next.js · Remix · Astro · Vite · Gatsby · Nuxt · SvelteKit

$ npx shadcn@latest add https://duskui.com/r/search-input.json
PropTypeDefaultDescription
value / onValueChangestring / (v: string) => void—Controlled value.
loadingbooleanfalseShow the spinner.
shortcutstring—Key used with ⌘/Ctrl to focus, e.g. "k".

Shimmer Input

A faint beam travels around the border while loading, for AI prompt fields while a response streams. Submit the demo to see it.

$ npx shadcn@latest add https://duskui.com/r/shimmer-input.json
PropTypeDefaultDescription
loadingbooleanfalseRun the border beam.
wrapperClassNamestring—Classes for the border wrapper.

API Reference

The base Input accepts every native <input> prop; styling hooks off native attributes like disabled, readOnly and aria-invalid.

PropTypeDefaultDescription
typestring"text"Any native input type.
aria-invalidboolean—Shows the destructive border and ring.
classNamestring—Merged with tailwind-merge, so overrides win.

Accessibility

  • Blocks never replace the native <input>, so autofill, password managers and screen readers keep working.
  • Floating labels are real <label> elements linked with htmlFor.
  • Password strength and OTP status are announced via aria-live; the visibility toggle uses aria-pressed.
  • Spinners, rings and shakes respect prefers-reduced-motion.