
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
react-autocomplete-tagbox
Advanced tools
React Autocomplete Tagbox is a modern, customizable React component for tag input with optional autocomplete. Effortlessly add, remove, and select tags with keyboard or mouse. Supports both free-form and restricted tag entry, smart suggestions, and a clea
Modern, flexible, and fully customizable React tag input with autocomplete.
React Autocomplete Tagbox is a modern, flexible, and fully customizable React component for tag input with optional autocomplete. Effortlessly add, remove, and select tags with keyboard or mouse. Supports both free-form and restricted tag entry, smart suggestions, and a clean, accessible UI. Perfect for forms, search bars, and dynamic filters. Easy to integrate and fully styleable to match your project.
filterData
): Accept only tags that match your custom logic (e.g., only URLs, emails, etc.).npm install react-autocomplete-tagbox
# or
yarn add react-autocomplete-tagbox
import React, { useState } from "react";
import ReactAutocompleteTagbox from "react-autocomplete-tagbox";
const options = [
"React",
"JavaScript",
"TypeScript",
"GraphQL",
"Redux",
"Bootstrap",
];
// Example filter: only allow options that are at least 5 characters
const filterData = (str: string) => str.length >= 5;
const filteredOptions = options.filter(filterData);
export default function App() {
const [tags, setTags] = useState<string[]>([]);
return (
<ReactAutocompleteTagbox
tags={tags}
onChange={setTags}
options={filteredOptions} // Filtered options
filterData={filterData}
limit={5}
placeholder="Add technologies..."
/>
);
}
Note:
If you use bothoptions
andfilterData
, only options that passfilterData
will be selectable or added as tags.
It's recommended to filter youroptions
withfilterData
before passing them to the component.
Prop | Type | Default | Description |
---|---|---|---|
tags | string[] | [] | The current list of tags. |
onChange | (tags: string[]) => void | Callback when tags change. | |
options | string[] | undefined | Optional. Restricts tags to these options and enables autocomplete. |
limit | number | undefined | Optional. Maximum number of tags allowed. |
placeholder | string | "Type and press ENTER to add tags..." | Placeholder text for the input. |
containerStyle | React.CSSProperties | undefined | Optional. Inline styles for the container. |
className | string | undefined | Optional. Additional class for the container. |
filterData | (data: string) => boolean | undefined | Optional. Custom validation/filter function for tags. |
If you use both options
and filterData
, make sure your options match your filter. For example, to only allow URLs:
const filterData = (str: string) => {
try {
const url = new URL(str.trim());
return url.protocol === "http:" || url.protocol === "https:";
} catch {
return false;
}
};
const filteredOptions = options.filter(filterData);
<ReactAutocompleteTagbox
tags={tags}
onChange={setTags}
options={filteredOptions}
filterData={filterData}
/>;
className
prop.Clone the repo and run:
npm install
npm run dev
Contributions, issues, and feature requests are welcome!
Feel free to check issues page.
React Autocomplete Tagbox — The smart, beautiful way to manage tags in your React apps!
FAQs
React Autocomplete Tagbox is a modern, customizable React component for tag input with optional autocomplete. Effortlessly add, remove, and select tags with keyboard or mouse. Supports both free-form and restricted tag entry, smart suggestions, and a clea
The npm package react-autocomplete-tagbox receives a total of 69 weekly downloads. As such, react-autocomplete-tagbox popularity was classified as not popular.
We found that react-autocomplete-tagbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.