1.1.1 • Published 4 months ago

react-tag-maker v1.1.1

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
4 months ago

react-tag-maker

GloomyTags is a custom tag input component for React. This component provides functionality to add and remove tags, enhancing the user experience with various options.

Installation

You can install the package using npm or yarn.

npm install react-tag-maker

or

yarn add react-tag-maker

Usage

Usage Example

You can use the GloomyTags component to create a tag input field. The basic usage is as follows:

Basic Use

import React, { useState } from 'react';
import GloomyTags from 'react-tag-maker';

function App() {
  const [state, setState] = useState([]);

  return (
    <GloomyTags
      state={state}
      setState={setState}
    />
  );
}

export default App;

Use Options

import React, { useState } from 'react';
import GloomyTags from 'react-tag-maker';

function App() {
  const [state, setState] = useState([]);

  return (
    <GloomyTags
      state={state}
      setState={setState}
      disableBackspaceRemove={false} // Whether to remove tags with Backspace
      isEditOnRemove={false} // Whether to switch to edit mode when a tag is removed
      throttleTime={300} // Input throttle time
    />
  );
}

export default App;

Styling

The component includes basic styles and is provided in a CSS-in-JS manner. Use the classNames and style props to apply additional styles.

Props

GloomyTags

  • name (optional): The name attribute of the <input> element.
  • placeHolder (optional): The placeholder text for the <input> element.
  • state: An array of strings representing the current tag state.
  • setState: A function to update the tag state.
  • onChange (optional): Callback function called when the tag state changes.
  • onBlur (optional): Callback function called when the <input> element loses focus.
  • separators (optional): Array of keys to separate tags (e.g., [' ', ',']).
  • disableBackspaceRemove (optional): Whether to allow removing tags with the Backspace key.
  • onExisting (optional): Callback function called when an existing tag is entered.
  • onRemoved (optional): Callback function called when a tag is removed.
  • disabled (optional): Whether to disable the component.
  • isEditOnRemove (optional): Whether to switch to edit mode when a tag is removed.
  • beforeAddValidate (optional): Function for validating before adding a tag.
  • onKeyUp (optional): Keyup event handler for the <input> element.
  • classNames (optional): Object to specify CSS class names. { tag?: string, input?: string }.
  • style (optional): Object to apply inline styles.
  • throttleTime (optional): Input throttle time.

Tag

  • text: Text to display on the tag.
  • remove: Function to remove the tag.
  • disabled (optional): Whether to disable the remove button on the tag.
  • className (optional): CSS class name for the tag.

Contributing

If you wish to contribute, please submit a pull request after documenting or reporting an issue.

License

GPLv3 License

1.1.1

4 months ago

1.1.0

11 months ago

1.0.50

11 months ago

1.0.48

11 months ago

1.0.47

11 months ago

1.0.46

11 months ago

1.0.45

11 months ago

1.0.43

11 months ago

1.0.42

11 months ago

1.0.41

11 months ago

1.0.40

11 months ago

1.0.39

11 months ago

1.0.37

11 months ago

1.0.36

11 months ago

1.0.35

11 months ago

1.0.34

11 months ago

1.0.33

11 months ago

1.0.32

11 months ago

1.0.31

11 months ago

1.0.30

11 months ago

1.0.29

11 months ago

1.0.28

11 months ago

1.0.27

11 months ago

1.0.26

11 months ago

1.0.24

11 months ago

1.0.23

11 months ago

1.0.22

11 months ago

1.0.21

11 months ago

1.0.20

11 months ago

1.0.19

11 months ago

1.0.18

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

12 months ago