Textarea
Displays a form textarea or a component that looks like a textarea.
# Demo
# Attributes
Name | Type | Default | Details |
---|---|---|---|
className | string | ' ' | You can customise by passing tailwind classes. |
labelClassName | string | ' ' | You can customise by passing tailwind classes. |
textareaClassName | string | ' ' | You can customise by passing tailwind classes. |
id | string | textarea | You can pass id to create unique identifier. |
label | string | ' ' | You can pass label of the textarea. |
placeholder | string | ' ' | You can pass placeholder of the textarea. |
value | string | ' ' | You can pass value of the textarea. |
disabled | boolean | false | You can pass disabled to set default textarea state. |
onChange | (value: string | number) => void | Required | You can get callback when textarea value changed. |
Note: Along with these params you can also pass all default textarea params.
# Usage
import { useState } from 'react';
import { NTextarea } from 'nayan';
const Textarea = () => {
const [address, setAddress] = useState('Bangalore, India');
return (
<NTextarea
id="ta1"
label="Address"
placeholder="Enter address"
className="mb-3"
rows={3}
value={address}
onChange={e => setAddress(e.target.value)}
/>
);
};
export default Textarea;