We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 977fb51 commit 9159ba1Copy full SHA for 9159ba1
src/Chip.jsx
@@ -0,0 +1,30 @@
1
+import React from 'react'
2
+import CloseIcon from './CloseIcon'
3
+
4
+export default function Chip({ value, deleteAction }) {
5
+ const showChipText = (opt) => {
6
+ if (typeof opt.label === 'object') {
7
+ return opt?.title || opt.value
8
+ } else {
9
+ return opt.label
10
+ }
11
12
13
+ return (
14
+ <div clickable='true' className='msl-chip'>
15
+ {showChipText(value)}
16
+ <div
17
+ role='button'
18
+ clickable='true'
19
+ aria-label='delete-value'
20
+ onClick={deleteAction}
21
+ onKeyPress={deleteAction}
22
+ tabIndex='0'
23
+ className='msl-btn msl-chip-delete msl-flx'
24
+ >
25
+ <CloseIcon />
26
+ </div>
27
+ <span />
28
29
+ )
30
+}
0 commit comments