NOCTA UI

Input

A versatile input component with multiple variants, sizes, icons, and dark mode support

Installation

Install the Input component using the nocta-ui CLI:

Terminal
npx nocta-ui add input

Then import the component:

Import
import { Input } from '@/components/ui/input';

Basic Usage

Default Input

Input with Label

Input with Helper Text

Choose a unique username between 3-20 characters

Variants

The Input component supports three variants: default, error, and success.

This field is required

Valid input

Sizes

Three size options are available: sm, md, and lg. The default size is md.

Input with Icons

Left Icon

Right Icon

Input States

Disabled State

Read Only State

This field is read-only

Customization

Custom Styling

The Input component accepts className and containerClassName props for custom styling:

Custom Styling
<Input 
  className="border-2 border-purple-300 focus-visible:border-purple-500"
  containerClassName="max-w-xs"
  label="Custom Styled Input"
  placeholder="Custom styling"
/>

<Input 
  className="rounded-full"
  label="Rounded Input"
  placeholder="Fully rounded"
/>

Custom Container

Props

PropTypeDefaultDescription
variant'default' | 'error' | 'success''default'Input style variant
size'sm' | 'md' | 'lg''md'Input size
labelstringLabel text displayed above the input
helperTextstringHelper text displayed below the input
errorMessagestringError message (shown when variant is 'error')
leftIconReact.ReactNodeIcon displayed on the left side
rightIconReact.ReactNodeIcon displayed on the right side
classNamestring''Additional CSS classes for the input
containerClassNamestring''Additional CSS classes for the container
disabledbooleanfalseDisable the input
readOnlybooleanfalseMake the input read-only
placeholderstringPlaceholder text
typestring'text'Input type (text, email, password, etc.)

The Input component also accepts all standard HTML input attributes.