1.4.12 • Published 2 years ago

tags-input-reactjs v1.4.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Tags Input

Simple react tags input with React, TypeScript and Tailwindcss.

Installation

npm install --save tags-input-reactjs

yarn add tags-input-reactjs

Features

Available props

PropsTypesDefault
1mode'array-of-string' or 'multi-select' or'advanced-multi-select'--------Mandatory
2theme'light' or 'dark'lightoptional
3maxTagsnumber--------optional
4defaultSelectedTagsstring[]--------optional
5categoriesTagsstring[]optional
6onChange(tags: string[]) => voidoptional
7titlestringoptional
8inputPlaceholderstring'آیتم‌ها را با Enter از هم جدا کنید.'optional
9inputClassNamestringoptional
10addToCategoryOnClick(value: string) => booleanoptional
11dropDownContainerClassNamestringoptional
12tagsContainerClassNamestringoptional
13tagsClassNamestringoptional
14selectedTagClassNamestringoptional
15selectedTagCloseIconClassstringoptional
16closeIconcomponentoptional

Simple Usage

// In layout.tsx file in Nextjs 13.4 project added this
import 'tags-input-reactjs/styles.css';

// In _app.tsx file in Nextjs < 13.4 project added this
import 'tags-input-reactjs/styles.css';

// Add this in the component you want to use in Nextjs
import ReactTags from 'tags-input-reactjs';

// In App.jsx or App.tsx file in Vite React or create-react-app projects added this
import ReactTags from 'tags-input-reactjs';
import 'tags-input-reactjs/styles.css';
import ReactTags from 'tags-input-reactjs';

const App = () => {
    return (
        <div>
            <ReactTags mode="array-of-string" />
        </div>
    );
};

Advanced Examples

// in layout.tsx file in nextjs project added this
import 'tags-input-reactjs/styles.css';

// in App.jsx or App.tsx file in React project added this
import ReactTags from 'tags-input-reactjs';
import 'tags-input-reactjs/styles.css';

// in App.jsx or App.tsx file in Vite React project added this
import ReactTags from 'tags-input-reactjs';
import 'tags-input-reactjs/styles.css';
import { useState } from 'react';
import ReactTags from 'tags-input-reactjs';

const App = () => {
    const [tags, setTags] = useState(['apple', 'orange', 'banana']);
    const [categoriesTags, setCategoriesTags] = useState(['apple', 'orange', 'banana', 'kiwi', 'grape']);

    return (
        <div>
            <ReactTags
                mode="advanced-multi-select"
                title="My Tags"
                maxTags={5}
                theme="dark"
                defaultSelectedTags={tags}
                onChange={(tags) => setTags(tags)}
                categoriesTags={categoriesTags}
                addToCategoryOnClick={(value) => setCategoriesTags([...categoriesTags, value])}
            />
        </div>
    );
};

License

Licensed under MIT

1.4.12

2 years ago

1.4.11

2 years ago

1.4.10

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.14

2 years ago

1.3.13

2 years ago

1.3.12

2 years ago

1.3.11

2 years ago

1.3.10

2 years ago

1.9.10

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago