Input

An Input component is a user interface element that allows users to enter data, such as text, numbers, or selections. It typically includes various types, such as text fields, checkboxes, radio buttons, and dropdowns, providing flexibility for different data types. Input components are essential for forms and interactive applications, enabling users to submit information effectively and efficiently.

Demo

Usage

import { NInput } from '@nayan-ui/react';
import { useState } from 'react';
const Input = () => {
const [email, setEmail] = useState('niranjan.devasani@gmail.com');
return (
<NInput id="email" type="email" label="Email" placeholder="Enter email" className="mb-3" value={email} onChange={e => setEmail(e.target.value)} />
);
};
export default Input;

Attributes

NameTypeDefaultDetails
idstringOptionalYou can pass id to create unique identifier.
labelReact.ReactNodeOptionalLabel for the input field.
labelClassNamestring' 'You can customise by passing tailwind classes.
inputClassNamestring' 'You can customise by passing tailwind classes.
wrapperClassNamestring' 'You can customise wrapper by passing tailwind classes.
errorReact.ReactNodeOptionalError message to display.
helperTextReact.ReactNodeOptionalHelper text to display.
onChange(e: React.ChangeEvent<HTMLInputElement>) => voidOptionalChange event handler.