Skip to Content
NarakUI

Input

A text field with an optional label, icons, hint, and error message.

Basic usage

A labeled field. required sets the native attribute and draws no marker, so say in the label or hint when a field is optional.

Sizes

Three sizes: mini, small, and regular (the default).

States

Default, disabled, read-only, and error. errorMessage shows below the field while error is true and is linked to it for screen readers. Type a domain with a dot to clear the error.

Enter a domain such as globex.com

With icons

iconStart and iconEnd take an icon name, an icon descriptor, or a node. Set onEndIconClick and endIconLabel to turn the end icon into a button, such as a show-password toggle.

Form example

Controlled inputs with hints, laid out in a responsive grid.

Answer engines are prompted with questions about this category
We send the weekly visibility report to this address

With suggestions

SuggestionInput wraps Input with a filtered suggestions dropdown. Import it from @/components/ui/input; it accepts every Input prop except standalone and fieldOverlay, plus suggestions, onSuggestionSelect, maxSuggestions (default 6), renderSuggestion, and forceShowDropdown (skeleton rows while loading).

Start typing to see suggestions

Installation

pnpm dlx shadcn@latest add @narakui/input

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/input.json.

Usage

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

<Input label="Report recipient" placeholder="you@acme.com" type="email" required />

Properties

PropTypeDefaultDescription
labelReactNode—Label text for the input field
endLabelReactNode—Content shown at the end of the label row
placeholderstring—Placeholder text when input is empty
typestring'text'HTML input type (text, password, email, etc.)
size'mini' | 'small' | 'regular''regular'Size of the input
variant'control' | 'chromeless''control'chromeless drops the field's own surface so it takes on the surface it sits on
standalonebooleanfalseRenders the native input as the surface itself, with no wrapper. Cannot be combined with icons, preInputNode, fieldOverlay, or inputWrapperClassName
disabledbooleanfalseWhether the input is disabled
readOnlybooleanfalseWhether the input is read-only
requiredbooleanfalseWhether the input is required
errorbooleanfalseWhether to display the input in error state
errorMessagestring—Error message shown below the input while error is true
iconStartInputIconValue—Icon name, descriptor, or node at the start of the input
iconEndInputIconValue—Icon name, descriptor, or node at the end of the input
onEndIconClick(e: React.MouseEvent<HTMLButtonElement>) => void—Callback fired when the end icon is clicked; renders the end icon as a focusable button (requires endIconLabel)
endIconLabelstring—Accessible name for the end icon button; required when onEndIconClick is set
preInputNodeReactNode—Node rendered before the input element
fieldOverlayReactNode—Content anchored to the field surface, such as a suggestions popover
hintstring | ReactNode—Helper text displayed below the input
valuestring—Controlled input value
onChange(e: ChangeEvent<HTMLInputElement>) => void—Callback function to handle input change
onFocus(e: FocusEvent<HTMLInputElement>) => void—Callback function to handle input focus
onBlur(e: FocusEvent<HTMLInputElement>) => void—Callback function to handle input blur
onKeyDown(e: KeyboardEvent<HTMLInputElement>) => void—Callback function to handle input key down
autoFocusbooleanfalseWhether to auto focus the input
autoComplete'off' | 'on''off'Whether to auto complete the input
classNamestring—Additional CSS classes to apply to the input container
inputClassNamestring—Additional CSS classes to apply to the input element
inputWrapperClassNamestring—Additional CSS classes to apply to the input wrapper
idstring—Native field ID. Generated when omitted; inputRest.id takes precedence
namestring—Name attribute for the input
nativeClipboardSourcebooleanfalseMarks the input as a native clipboard source for surrounding shortcut scopes
inputRestComponentPropsWithoutRef<'input'>—Extra props spread onto the native input element