Get Started
Components
Search Field
A Search Field component is a UI element that provides a text input specifically designed for search functionality. It includes a built-in search icon and clear button, allowing users to quickly enter, modify, and clear search queries.
Demo
Query: Empty
Usage
import { useState } from 'react';import { NSearchField } from '@nayan-ui/react';const SearchField = () => {const [query, setQuery] = useState('');return (<NSearchFieldvalue={query}onChange={setQuery}placeholder="Search components..."/>);};export default SearchField;
Attributes
| Name | Type | Default | Details |
|---|---|---|---|
| value | string | Optional | Controlled value. |
| defaultValue | string | Optional | Default value. |
| onChange | (value: string) => void | Optional | Callback when value changes. |
| onSubmit | (value: string) => void | Optional | Callback on submit. |
| onClear | () => void | Optional | Callback when cleared. |
| placeholder | string | 'Search...' | Placeholder text. |
| isDisabled | boolean | false | Disables the search field. |
| isInvalid | boolean | false | Marks as invalid. |
| variant | 'primary' | 'secondary' | 'primary' | Visual variant. |
| fullWidth | boolean | false | Full width mode. |
| className | string | ' ' | Additional CSS classes. |