1.1.13 • Published 1 month ago

qbs-core v1.1.13

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

AutoComplete Component

The AutoComplete component offers a user-friendly input experience by presenting suggestions based on their input, allowing for efficient and interactive form filling. This component can work with both local and asynchronous data, and provides single and multi-select functionality.

Table of Contents

Features

  • Single & Multi-select: Allows users to select a single or multiple suggestions.
  • Asynchronous Data Support: Can fetch suggestions from an API or use local data.
  • Pagination: Supports paginated data with a "Load More" feature.
  • Customizable: Provides props for styling, placeholder text, and more.
  • Error Handling: Displays validation errors.

Installation

Before you can use the AutoComplete component, ensure you've imported it properly.

npm install qbs-core
import {AutoComplete} from 'qbs-core';

function ExampleComponent() {
  return (
    <AutoComplete
      label="Search"
      onChange={handleChange}
      getData={fetchSuggestions}
      required={true}
      placeholder="Type to search..."
      type="auto_complete"
      async={true}
    />
  );
}

Props

You can pass the following props to the AutoComplete component:

  • label (string): Label for the input field.
  • onChange (function): Callback when the value changes.
  • getData (function): Asynchronous function to retrieve suggestions. By default, it returns an empty array.
  • data (Array): Local data source for suggestions.
  • errors (object): Validation error messages.
  • required (boolean): Indicates if the input is mandatory. Defaults to false.
  • name (string): Name attribute for the input element.
  • fullWidth (boolean): If true, the input will take the full width of its container. Defaults to false.
  • placeholder (string): Placeholder text for the input.
  • id (string): ID attribute for the input element.
  • type (string): Determines the type of autocomplete (custom_select, auto_complete, or auto_suggestion). Defaults to custom_select.
  • readOnly (boolean): Makes the input read-only if set to true. Defaults to false.
  • disabled (boolean): Disables the input if set to true. Defaults to false.
  • value (string): Value of the input.
  • isMultiple (boolean): If true, allows for multiple selection. Defaults to false.
  • desc (string): The key name for displaying suggestion items. Defaults to 'name'.
  • descId (string): The key name for the unique ID of suggestion items. Defaults to 'id'.
  • singleSelect (boolean): If set to true, adds checkbox functionality in single-select mode.
  • className (string): CSS class for styling the input component.
  • async (boolean): If true, indicates that the getData function is asynchronous.
  • nextBlock (function or boolean): Function for pagination or boolean to determine if pagination is enabled.
  • paginationEnabled (boolean): If true, pagination for suggestions is enabled.

Contribution

If you'd like to contribute to the improvement of the AutoComplete component, please follow the standard contribution guidelines for this project. Your feedback and contributions are valuable!

1.1.13

1 month ago

1.1.9

2 months ago

1.1.12

2 months ago

1.1.11

2 months ago

1.1.10

2 months ago

1.1.8

3 months ago

1.1.7

3 months ago

1.1.6

3 months ago

1.1.5

3 months ago

1.1.4

3 months ago

1.1.3

4 months ago

1.1.2

4 months ago

1.1.1

4 months ago

1.0.62

4 months ago

1.0.61

4 months ago

1.0.60

4 months ago

1.0.63

4 months ago

1.0.59

5 months ago

1.0.58

5 months ago

1.0.57

5 months ago

1.0.56

5 months ago

1.0.55

5 months ago

1.0.54

5 months ago

1.0.53

5 months ago

1.0.52

5 months ago

1.0.51

5 months ago

1.0.50

5 months ago

1.0.49

5 months ago

1.0.48

5 months ago

1.0.47

6 months ago

1.0.46

6 months ago

1.0.45

6 months ago

1.0.44

6 months ago

1.0.43

6 months ago

1.0.42

6 months ago

1.0.41

6 months ago

1.0.40

6 months ago

1.0.39

6 months ago

1.0.38

6 months ago

1.0.37

6 months ago

1.0.36

6 months ago

1.0.35

7 months ago

1.0.34

7 months ago

1.0.33

7 months ago

1.0.32

7 months ago

1.0.31

7 months ago

1.0.30

7 months ago

1.0.29

7 months ago

1.0.28

7 months ago

1.0.27

7 months ago

1.0.26

7 months ago

1.0.25

7 months ago

1.0.24

7 months ago

1.0.23

7 months ago

1.0.22

7 months ago

1.0.21

7 months ago

1.0.20

7 months ago

1.0.19

7 months ago

1.0.18

7 months ago

1.0.17

7 months ago

1.0.16

7 months ago

1.0.15

7 months ago

1.0.14

7 months ago

1.0.13

7 months ago

1.0.12

7 months ago

1.0.11

7 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago