Skip to contentVibraUI
Inputs & filters

Input

A single-line text field on the card plane with the field boundary.

Vibra puts the field on the card plane with its --input boundary — the line weight that carries 3:1 against the page — in both modes, where shadcn's is transparent and turns translucent in the dark; it focuses with the kit's solid 2px accent outline instead of a translucent ring and goes to the muted plane when disabled.

Install

npx shadcn@latest add @vibra/input

Needs the @vibra registry in your components.json — set it up once.

Examples

With a description

A hint under the field, joined to it with aria-describedby so it is read after the label.

Sized to the answer

Each field as wide as what it expects: a long legal name, a short postcode, a two-figure rate.

Time of day

A native time field in the kit's shape: the platform's own picker on a phone, the zone said beside it.

File

The browser's file picker in the field's shape. The rules come first, and a file that breaks one is refused in words.

With an error

Checked when the reader leaves the field: aria-invalid, a message that says what to type, and both gone once it is fixed.

Rules as you type

The rules are the field's description, and each says in words whether it holds; the tick only repeats it.

Checked by the server

A spinner while it asks, one status line for the answer, and aria-invalid when the address is taken.

Character limit

Going over is allowed and said in words, not cut off; a screen reader hears the count when typing pauses.

Disabled, with a reason

Tab skips a disabled field, so the reason is text under it, joined to it for whoever lands there.

Read-only, with copy

Read-only rather than disabled: in the Tab order, at full contrast, selectable, and copied whole in one press.

With an icon

An InputGroup addon before the text. The icon only hints; the label names the field, so the glyph is hidden.

With a prefix and a suffix

The fixed parts of an address sit in the field as text and describe it, so the whole address is heard.

With a button

A button that acts on this field alone sits inside it. A wrong code is an error on the field; a right one, a status line.

With a keyboard shortcut

N focuses the field from anywhere but another field. The keycap shows it and aria-keyshortcuts says it.

Formats when you leave it

Typed however it was copied, grouped in fours on blur — never while typing, where a jumping caret loses keys.

A range

Two fields under one legend, each named for its end; a range that runs backwards is refused on both.

In a sentence

A number inside the sentence it finishes, labelled by the whole sentence so it is heard the way it is read.

In a table

Fields in rows, each named for its row and column, with a total that follows them.

Right to left

An Arabic form with the icon at the inline start. The email field reads left to right, lined up with the form's edge.

Dependencies

Source

components/ui/input.tsx
import * as React from "react"
import { Input as InputPrimitive } from "@base-ui/react/input"
import { cn } from "@/lib/utils"

function Input({ className, type, ...props }: React.ComponentProps<"input">) {
  return (
    <InputPrimitive
      type={type}
      data-slot="input"
      className={cn(
        "h-8 w-full min-w-0 rounded-lg border border-input bg-card px-2.5 py-1 text-base transition-colors focus-ring file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-50 aria-invalid:border-destructive md:text-sm",
        className
      )}
      {...props}
    />
  )
}

export { Input }