📌 A chips input designed for MUI (Material ui) V5

Overview

MUI chips input

A chips input designed for the React library MUI

license ts npm

Installation

// with npm
npm install mui-chips-input

// with yarn
yarn add mui-chips-input

Usage

import React from 'react'
import { MuiChipsInput } from 'mui-chips-input'

const MyComponent = () => {
  const [chips, setChips] = React.useState([])

  const handleChange = (newChips) => {
    setChips(newChips)
  }

  return (
    <MuiChipsInput value={chips} onChange={handleChange} />
  )
}

Documentation

Changelog

Go to Github Releases

TypeScript

This library comes with TypeScript "typings". If you happen to find any bugs in those, create an issue.

🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

💡 Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding a 👍 . This helps maintainers prioritize what to work on.

LICENSE

MIT

Comments
  • Add Start and End Adornments to mui-chips-input

    Add Start and End Adornments to mui-chips-input

    Is your feature request related to a problem? Please describe. I am trying to implement a mui-chips-input where an action needs to be taken on those items.

    Describe the solution you'd like Instead of just text, I want to be able to use this for emails, and would like to be able to include SendIcon to be able to take send email action on it. To be able to provide email validation and max items that can be added would also be great.

    Describe alternatives you've considered I tried converting a react solution to mui-chip solution, which does most of the the work, except it puts the chips above the textfield instead of inside the textfield. I would like for them to be inside the textfield.

    Additional context None

    enhancement 
    opened by harmanbirdi 11
  • TypeError: Cannot read properties of null (reading 'useState')

    TypeError: Cannot read properties of null (reading 'useState')

    Describe the bug TypeError: Cannot read properties of null (reading 'useState')

    To Reproduce Steps to reproduce the behavior:

    1. Add package - yarn add mui-chips-input
    2. Import Package
    3. Compile Code

    Expected behavior Expecting @MUI chips input...

    GOT `Unhandled Runtime Error TypeError: Cannot read properties of null (reading 'useState')

    Call Stack Object.useState node_modules/mui-chips-input/node_modules/react/cjs/react.development.js (1622:0) eval node_modules/mui-chips-input/dist/mui-chips-input.es.js (131:18) renderWithHooks node_modules/react-dom/cjs/react-dom.development.js (16175:0) updateForwardRef node_modules/react-dom/cjs/react-dom.development.js (20023:0) beginWork node_modules/react-dom/cjs/react-dom.development.js (22465:0) HTMLUnknownElement.callCallback node_modules/react-dom/cjs/react-dom.development.js (4161:0) Object.invokeGuardedCallbackDev node_modules/react-dom/cjs/react-dom.development.js (4210:0) invokeGuardedCallback node_modules/react-dom/cjs/react-dom.development.js (4274:0) beginWork$1 node_modules/react-dom/cjs/react-dom.development.js (27405:0) performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js (26513:0) workLoopSync node_modules/react-dom/cjs/react-dom.development.js (26422:0) renderRootSync node_modules/react-dom/cjs/react-dom.development.js (26390:0) performSyncWorkOnRoot node_modules/react-dom/cjs/react-dom.development.js (26041:0) flushSyncCallbacks node_modules/react-dom/cjs/react-dom.development.js (12009:0) flushSync node_modules/react-dom/cjs/react-dom.development.js (26157:0) finishEventHandler node_modules/react-dom/cjs/react-dom.development.js (3973:0) batchedUpdates node_modules/react-dom/cjs/react-dom.development.js (3991:0) dispatchEventForPluginEventSystem node_modules/react-dom/cjs/react-dom.development.js (9284:0) dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay node_modules/react-dom/cjs/react-dom.development.js (6462:0) dispatchEvent node_modules/react-dom/cjs/react-dom.development.js (6454:0) dispatchDiscreteEvent node_modules/react-dom/cjs/react-dom.development.js (6427:0)`

    @viclafouch

    opened by mahj0ubiwael 3
  • Type error with prop multiline

    Type error with prop multiline

    Describe the bug If I use <MuiChipsInput multiline rows={3} />, I get a type error. Note the prop actually work, it's just a type issue.

    To Reproduce Steps to reproduce the behavior:

    1. Go to https://codesandbox.io/s/ancient-field-jedk7g?file=/src/App.tsx
    2. See type error in code editor

    Expected behavior The prop should not raise a type error.

    Error is due to this line, I guess: https://github.com/viclafouch/mui-chips-input/blob/main/src/index.types.ts#L4

    opened by Elfayer 3
  • Add Chip on Spacebar

    Add Chip on Spacebar

    Is your feature request related to a problem? Please describe. We want to add chips on pressing spacebar, in addition to pressing Enter. Right now it seems the only way to do this is to use the "onInputChange," check for the last character being a space, and then "clearInputOnBlur" and manually blur/re-focus. I'm still struggling to get this to work correctly though.

    Describe the solution you'd like We could use a simple "addChipOnSpacebar" prop that would prevent the logic living outside the component. When a user types a space bar, run the validation, and then if it passes, trigger the addChip just as if they had pressed enter. Then clear the 'input value' to be ready to type the next entry.

    Probably also update the helper text to a new default, to represent the new condition.

    Describe alternatives you've considered I've tried overriding the inputProps={{value: ''}} and other similar changes. I'm thinking this prop was overridden to provide the chips themselves, and so I cannot seem to access the input's current typed-in-value, to clear it back out.

    As mentioned above, I've found the workaround of blurring the input, and using the clearInputOnBlur prop.

    Additional context N/A

    opened by mark-crafted 3
  • Expected hoisted manifest when trying to install with yarn and @emotion/react version 11.10.4

    Expected hoisted manifest when trying to install with yarn and @emotion/react version 11.10.4

    When trying to install in a project with "@emotion/react": "11.10.4",

    yarn add mui-chips-input

    fails throwing the error:

    expected hoisted manifest for "mui-chips-input#@mui/material#@emotion/styled"

    Steps to reproduce the behavior:

    git clone 'https://github.com/arunlodhi/mui-chips-input-error'
    
    yarn install
    
    yarn add mui-chips-input
    
    opened by arunlodhi 2
  • Failure to handle events processed by an IME

    Failure to handle events processed by an IME

    Describe the bug

    Chip is added when I press Enter to confirm the conversion by an IME.

    To Reproduce

    1. Go to https://viclafouch.github.io/mui-chips-input/
    2. Type Japanese (For example 'りんご')
    3. Press Enter key

    Expected behavior

    Chips is not added during an IME processing.

    Screenshots

    https://user-images.githubusercontent.com/18608707/206427008-6e21a2e8-14ef-41ec-a2be-ced43dab01ea.mov

    Desktop

    • OS: macOS Monterey (v12.6.1)
    • Browser: Google Chrome
    • Version: 108.0.5359.98

    Additional context

    PR is already ready. Please close it if you don't need it.

    Thank you for the wonderful library!

    opened by hey-cube 1
  • Need to control inputValue

    Need to control inputValue

    Is your feature request related to a problem? Please describe. I want to have a scan input, for that I use a debounce on the onInputChange, when 300ms passed, I set the chips. But after that, I need to reset the input value (but I do not have control over inputValue, see: https://github.com/viclafouch/mui-chips-input/blob/main/src/components/TextFieldChip/TextFieldChips.tsx#L66)

    Describe the solution you'd like Need to have inputValue as props of MuiChipsInput.

    Code usage sample

    export default function ScanForm() {
      const [chips, setChips] = useState<string[]>([])
      const [scanValue, setScanValue] = useState('')
      const scanValueDebounced = useDebounce(scanValue, 300)
    
      useEffect(() => {
        setChips([...chips, scanValueDebounced])
        // reset scanValue, should reflect in MuiChipsInput
      }, [scanValueDebounced])
    
      function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
        e.preventDefault()
        // ...
      }
    
      return (
        <form onSubmit={handleSubmit}>
          <MuiChipsInput value={chips} onInputChange={(v) => setScanValue(v)} />
          <Button>submit</Button>
        </form>
      )
    }
    
    opened by Elfayer 1
  • fix: handle events processed by an IME

    fix: handle events processed by an IME

    This PR solves #11 . However, it has two drawbacks.

    1. keyCode is deprecated.
    2. @testing-library/user-event cannot simulate keyCode

    This is the only way I could come up with. If the quality is unsatisfactory, please close.

    opened by hey-cube 0
  • control on the rendered parentdiv of the chips div

    control on the rendered parentdiv of the chips div

    Is your feature request related to a problem? Please describe. I'm having a hard time setting up the paddings for the parentdiv. I currently saw that there is override changes to .MuiInputBase-root class which gives row-gaps and paddings.

    Describe the solution you'd like Would be good if there is a solution for the rendered parent div or any docs how to get the behaviour on how it is rendered.

    Describe alternatives you've considered Getting it from mui5 directly and not having default paddings/styling.

    Additional context Only if my issue is relevant. Thanks.

    opened by immortal-pewpew 0
Releases(v1.3.2)
  • v1.3.2(Dec 23, 2022)

  • v1.3.1(Sep 26, 2022)

  • v1.3.0(Sep 18, 2022)

    Features

    New prop addOnWhichKey. Choose on which key (that matches event.key) the user will use to add the current chip. Default enter.

    <MuiChipsInput addOnWhichKey={['a', ' ']} />
    <MuiChipsInput addOnWhichKey=" " />
    
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Sep 15, 2022)

    Features

    2 new props ! 🥹

    disableEdition

    • Type: boolean
    • Default: false

    Prevent the user from editing a chip when double click on it.

    See doc reference here : https://viclafouch.github.io/mui-chips-input/docs/api-reference/#disableedition

    <MuiChipsInput disableEdition />
    

    renderChip

    • Type: (ChipComponent: MuiChipsInputChipComponent, ChipProps: MuiChipsInputChipProps) => JSX.Element
    • Default: undefined

    Custom how to render a Chip element in case if you want to add / edit the Chip props.

    <MuiChipsInput renderChip={(Component, props) => {
      return <Component {...props} deleteIcon={<FaceIcon />} />
    }} />
    

    See doc reference here : https://viclafouch.github.io/mui-chips-input/docs/api-reference/#renderchip

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Sep 4, 2022)

    Feature

    • Can edit a chip by double clicking on it
    • New prop : onEdit. Gets called once the user has edited a chip.
    const handleEditChip = (chipValue, chipIndex) => {
      /**
      chipValue: 'bar'
      chipIndex: 0
      **/
    }
    
    <MuiChipsInput value={['foo']} onEditChip={handleEditChip} />
    
    Source code(tar.gz)
    Source code(zip)
Owner
Victor de la Fouchardière
Web Frontend Developer at @frichti . TypeScript/Javascript enthusiast.
Victor de la Fouchardière
A react native component that lets you build a dynamic expandable chips list.

React Native Expandable Chips List A react native component that lets you build a dynamic expandable chips list. Installation Run npm install react-na

Daniel Cocos 13 Sep 23, 2022
Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.

Material-UI Quickly build beautiful React apps. Material-UI is a simple and customizable component library to build faster, beautiful, and more access

Material-UI 83.6k Dec 30, 2022
A frontend Framework for building B2B applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Material Design

react-admin A frontend Framework for building data-driven applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Materi

marmelab 21.2k Dec 30, 2022
A set of React components implementing Google's Material Design specification with the power of CSS Modules

React Toolbox is a set of React components that implement Google's Material Design specification. It's powered by CSS Modules and harmoniously integra

React Toolbox 8.7k Dec 30, 2022
Wall Covering Calculator and Material Procurement Portal

Wall-Pro MPP --Wall Covering Calculator and Material Procurement Portal-- Table of Contents: Links Description UserStory DevelopmentTeam Installation

Mike Bussert 4 Jul 7, 2021
İnstagram Clone.You can sign in, sign up, upload image, make comment 📷 Used ReactJS, Material UI, Firebase, Firestore Database

?? instagram-clone This is a instagram clone. You can sign in, sign up, upload image, make comment ?? ⚡ LIVE To check out the live demo of this app AB

null 22 Apr 20, 2022
Soft UI Dashboard React - Free Dashboard using React and Material UI

Soft UI Dashboard React Start your Development with an Innovative Admin Template for Material-UI and React. If you like the look & feel of the hottest

Creative Tim 182 Dec 28, 2022
👉 Built my first React JS project "ToDo" webapp using some Features and Icons from Material UI.

# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Avai

Vansh Chitlangia 2 Dec 15, 2021
Worldwide-covid-statistics - covid-19 tracker developed using Reactjs, Axios , chartjs, material icons

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Akinmegha Temitope Samuel 1 Jan 3, 2022
Bdc-walkthrough - An Angular Material library for displaying walk-through pop-ups and dialogs using a declarative way.

Material walk-through library An Angular Material library for displaying walk-through pop-ups and dialogs using a declarative way. Show Demo Prerequis

Broadcom Inc 65 Dec 14, 2022
Material Design Web Components

Material Web IMPORTANT: Material Web is a work in progress and subject to major changes until 1.0 release. Material Web is Google’s UI toolkit for bui

Material Components 4.6k Dec 31, 2022
Material Design Lite for Ember.js Apps

ember-material-lite Google's Material Design Lite for Ember.js apps This addon requires ember >= 1.11.0 Installation # ember-cli < 0.2.3 ember install

Mike North 148 Dec 17, 2021
Ember implementation of Google's Material Design

No longer maintained This project is no longer maintained. For an up-to-date material design project, please use Ember Paper. Ember-material-design Th

Mike Wilson 121 Mar 1, 2022
A beautiful and easy in hand blog made by Next.js Material-ui

Material-blog A beautiful and easy in hand blog made by Next.js Material-ui! Deploy your own Deploy the example using Vercel: Usage Install node_modul

Willie Xu 1 Mar 3, 2022
A PhotoShot Plugin to get material you colors easily.

material-you 可以快速获取符合 material-you 配色的 PhotoShop 插件。 参考自 Material Theme Builder 安装 初次安装 从 release 中下载压缩包并解压。打开 Photoshop ,运行 文件-脚本-浏览 ,选择安装包中的 安装脚本.js

周财发 4 Jun 17, 2022
A component library based on Material Design 3 & Web Components

material-web-entity Material Web Entity A component library based on Material Design & Web Components Go to link to see what components this library s

HugePancake 5 Jun 3, 2022
Quick study on NextJs + Material UI

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Davi Nascimento 3 Jun 29, 2022
Course material for Mobile Application Development, Integrated Digital Media, Tandon School of Engineering, NYU

Mobile-Application-Development Course material for Mobile Application Development, Integrated Digital Media, Tandon School of Engineering, NYU Classs

Andreas Borg 3 May 1, 2022
Next.js + TypeScript + Material UI v5 + Sass + Storybook starter

nextjs-ts-mui5-scss-storybook-starter ?? Next.js + TypeScript + Material UI v5 + Sass + Storybook starter ?? with linting & prettier pre-configured Ma

Muhammad Ridho Anshory 13 Oct 19, 2022