Skip to main content
On this page

Input

Input component for collecting user text input with support for multiple variants, sizes, icons, and validation states.

import { Input } from "@ninna-ui/forms";

pnpm add @ninna-ui/forms@latest
Includes @ninna-ui/core. CSS setup required.View source

Usage

Import and use the Input component in your application.

import { Input } from "@ninna-ui/forms";
export default function Example() {
return (
<Input placeholder="Enter your name" />
);
}

Basic

Basic input with placeholder.

Live preview

Variants

Input supports outline, filled, flushed, and unstyled variants.

Live preview

Sizes

Input comes in 5 sizes: xs, sm, md, lg, and xl.

Live preview

Colors

Input supports multiple color themes for focus states.

Live preview

With Icons

Input with left and right icons.

Live preview

Clearable

Input with a clear button that appears when there's a value.

Live preview

Character Counter

Input with character count display when maxLength is set.

Live preview
0/50
36/100

Floating Label

Input with a floating label that animates on focus.

Live preview

Read Only

Input in read-only mode.

Live preview

Full Width

Control whether input takes full container width.

Live preview
Full width (default)
Auto width

States

Input in different states: normal, disabled, read-only, and invalid.

Live preview

React Hook Form

Input works seamlessly with React Hook Form using the register() pattern. Wrap with Field for labels and error messages.

Live preview

API Reference

Complete list of props for the Input component.

Props

PropTypeDefaultDescription
variant'outline' | 'filled' | 'flushed' | 'unstyled''outline'Visual style variant of the input
color'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'danger''primary'Color theme of the input focus state
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'Size of the input
clearablebooleanfalseShow clear button when input has value
onClear() => void—Callback when clear button is clicked
showCounterbooleanfalseShow character counter (requires maxLength)
maxLengthnumber—Maximum character length
floatingLabelstring—Floating label text
fullWidthbooleantrueWhether the input takes full width of its container
invalidbooleanfalseWhether the input is in an invalid state
disabledbooleanfalseWhether the input is disabled
readOnlybooleanfalseWhether the input is read-only
classNamestring—Additional CSS classes

Accessibility

  • Input has proper focus states with visible outlines
  • Disabled inputs have aria-disabled attribute
  • Invalid inputs have aria-invalid attribute
  • Works with FormControl for automatic label association via htmlFor
  • Keyboard navigation is fully supported