1.0.3 • Published 4 months ago

@enipx/react-tags-input v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

React Tags Input

Concise and efficient solution for creating tags input with option to style with react inline CSS or with css⚡

Installation

Install dependencies:

$ yarn add @enipx/react-tags-input

# or

$ npm i @enipx/react-tags-input

Usage

import { TagsInput } from "@enipx/react-tags-input"

export default function App() {
  return (
    <TagsInput
      value={selected}
      onChange={onChangeHandler}
      style={{
        border: `1px solid rgba(0,0,0,0.2)`,
        minHeight: '70px',
        borderRadius: '10px',
        padding: '0 1rem',
        fontSize: '0.85rem',
        paddingTop: '1rem',
      }}
      focusStyle={{
        border: `1px solid rgba(0,0,0,0.4)`,
      }}
      tagStyle={{
        border: `1px solid ${borderColor}`,
        borderRadius: '2rem',
        paddingLeft: '0.5rem',
        paddingRight: '0.5rem',
      }}
      {...rest}
    />
  )
}

Props

PropertyTypeDescription
valuestring[]Controlled value
onChange(arg: string[]) => voidReturn value when input changes
onAdd(arg: string) => voidcallback method when an item is added
onRemove(arg: string) => voidcallback method when an item is remove
onExist(arg: string) => voidcallback method when an item already exists in input
hoverStyleReact.CSSPropertiesAdd custom input style on hover
focusStyleReact.CSSPropertiesAdd custom input style on focus
tagStyleReact.CSSPropertiesAdd custom tag item style
separatorstringinput item separator, default is comma (,)
removeIconReact.ReactNodereplace tag remove icon
containerPropsHTMLAttributeupdate container div attribute

License

MIT ©

1.0.2

4 months ago

1.0.3

4 months ago

1.0.1

10 months ago

1.0.0

12 months ago