Skip to main content
ninna-ui

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

Requires @ninna-ui/core (auto-installed) + CSS setup.

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.

Variants

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

Sizes

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

Colors

Input supports multiple color themes for focus states.

With Icons

Input with left and right icons.

Clearable

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

Character Counter

Input with character count display when maxLength is set.

0/50
36/100

Floating Label

Input with a floating label that animates on focus.

Read Only

Input in read-only mode.

Full Width

Control whether input takes full container width.

Full width (default)
Auto width

States

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

React Hook Form

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

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