npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-chips-autocomplete

v1.0.2

Published

AutoCompleteChips is a versatile React component that combines an autocomplete input with a chip/tag display. It enables users to effortlessly input values by providing autocomplete suggestions and visually presents selected items as interactive chips. Cu

Downloads

11

Readme

React Chips Autocomplete

AutoCompleteChips is a versatile React component that combines an autocomplete input with a chip/tag display. It enables users to effortlessly input values by providing autocomplete suggestions and visually presents selected items as interactive chips. Customize the appearance and behavior of the component to seamlessly integrate it into your React applications.

Installation

You can install the package using npm:

npm install react-chips-autocomplete


usage 

import React from 'react';
import { AutoCompleteChips } from 'react-chips-autocomplete';

function App() {
  const Data = [
    { label: 'John Doe', id: 1 },
    { label: 'Jane Smith', id: 2 },
    { label: 'Alice Johnson', id: 3 },
    // Add more data as needed
  ];

  return (
    <AutoCompleteChips
      Data={Data} // must add Data[]
      listOnClick={(data) => console.log(data)}
      chipDeleteOnClick={(data) => console.log(data)}
      width={10}
      height={2}
      borderRadius={0}
      borderWidth={2}
      borderColor='lightblue'
      chipBgColor='red'
      chipTextColor='white'
      chipfontSize={12}
      chipMargin={2}
      crossFillColor='white'
      placeholder='Enter...'
    />
  );
}

export default App;



Props
+Data: An array of objects representing the data for autocomplete.
+listOnClick: Callback function triggered on selecting an item from the autocomplete list.
+chipDeleteOnClick: Callback function triggered on deleting a chip.
+width: Width of the component.
+height: Height of the input.
+borderRadius: Border radius of the input.
+borderWidth: Border width of the input.
+borderColor: Border color of the input.
+chipBgColor: Background color of the chips.
+chipTextColor: Text color of the chips.
+chipfontSize: Font size of the chips.
+chipMargin: Margin of the chips.
+crossFillColor: Fill color of the delete icon in the chips.

## Props

## CSS Class Names
textinput
Description: The input field of the AutoCompleteChips component.
chipcontainer
Description: The container for displaying the chips.
chipsubdiv
Description: The container for each individual chip.


#### `Data` (Array)

An array of objects representing the data for autocomplete. Each object should have at least a `label` and an `id`. Example:

```jsx
const Data = [
  { label: 'John Doe', id: 1 },
  { label: 'Jane Smith', id: 2 },
  { label: 'Alice Johnson', id: 3 },
  // Add more data as needed
];


listOnClick (Function)
A callback function triggered when a user selects an item from the autocomplete list. It receives the selected data as an argument. Example:
const handleListClick = (selectedData) => {
  console.log('Selected Data:', selectedData);
};

chipDeleteOnClick (Function)
A callback function triggered when a user deletes a chip. It receives the deleted chip's data as an argument. Example:
const handleChipDelete = (deletedChip) => {
  console.log('Deleted Chip:', deletedChip);
};

width (Number)
Width of the component. Example:

const width = 10;

height (Number)
Height of the input. Example:

const height = 2;


borderRadius (Number)
Border radius of the input. Example:

const borderRadius = 5;

borderWidth (Number)
Border width of the input. Example:

const borderWidth = 1;

borderColor (String)
Border color of the input. Example:

const borderColor = 'lightblue';

chipBgColor (String)
Background color of the chips. Example:

const chipBgColor = 'red';  

chipTextColor (String)
Text color of the chips. Example:

const chipTextColor = 'white';

chipfontSize (Number)
Font size of the chips. Example:

const chipfontSize = 12;

chipMargin (Number)
Margin of the chips. Example:

const chipMargin = 2; // in px

crossFillColor (String)
Fill color of the delete icon in the chips. Example:

const crossFillColor = 'white';

Placeholder = "The placeholder text for the input field."