# ListVirtual A searchable dropdown component with server-side filtering, infinite scrolling, and support for both single and multiple selection. ## Features * Server-side search * Infinite scrolling * Single select mode * Multiple select mode * Custom request headers via `ApiProvider` * Default value support * Material UI integration --- ## Installation ```bash npm install your-library-name ``` ## Import ```jsx import { ApiProvider, ListVirtual } from "your-library-name"; ``` --- ## Setup Wrap your application or component with `ApiProvider` to provide API headers. ```jsx ``` --- ## Single Selection ```jsx const [company, setCompany] = useState(null); { setCompany(row); }} /> ``` ### Selected Value ```js { id: 123, name: "My Company" } ``` --- ## Multiple Selection ```jsx const [companies, setCompanies] = useState([]); { setCompanies(rows); }} /> ``` ### Selected Value ```js [ { id: 1, name: "Company A" }, { id: 2, name: "Company B" } ] ``` --- ## Using Default Value ### Single Selection ```jsx ``` ### Multiple Selection ```jsx ``` --- ## Props | Prop | Type | Default | Description | | ------------ | -------------- | --------- | ----------------------------------------- | | id | string | - | Unique component identifier | | label | string | - | TextField label | | name | string | - | Property name used for display | | url | string | - | API endpoint used to fetch data | | getData | function | undefined | Callback triggered when selection changes | | defaultValue | object | array | undefined | Initial selected value | | multiple | boolean | false | Enable multiple selection mode | | disabled | boolean | false | Disable the component | | required | boolean | false | Mark field as required | | error | boolean | false | Error state | | helperText | string | undefined | Helper text displayed below the field | | size | string | "medium" | TextField size (`small` or `medium`) | | lengthData | number | 100 | Number of records fetched per request | | filter | array | [] | Additional API filters | | isApiGo | boolean | false | Use Go API request mode | --- ## Custom Filters ```jsx