4.0.0 • Published 7 months ago

@leafygreen-ui/chip v4.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

Chip

npm (scoped)

View on MongoDB.design

Installation

Yarn

yarn add @leafygreen-ui/chip

NPM

npm install @leafygreen-ui/chip

Example

import { Chip } from `@leafygreen-ui/chip`;

<Chip label="leafygreen" />

or

<Chip
  label="leafygreen"
  variant="blue"
  baseFontSize={13}
  disabled
  onDismiss={() => {}}
  chipCharacterLimit={10}
  chipTruncationLocation="end"
  dismissButtonAriaLabel="aria-label"
  darkMode
/>

Properties

PropTypeDescriptionDefault
labelReact.ReactNodeLabel rendered in the chip
chipTruncationLocation'end' | 'middle' | 'none' | 'start'Defines where the ellipses will appear in a Chip when the label length exceeds the chipCharacterLimit. If none is passed, the chip will not truncate. Note: If there is any truncation, the full label text will appear inside a tooltip on hovernone
chipCharacterLimitnumberDefines the character limit of a Chip before they start truncating. Note: the three ellipses dots are included in the character limit and the chip will only truncate if the chip length is greater than the chipCharacterLimit.
baseFontSize'13' | '16'Determines the base font-size of the chip.
variant'gray' | 'blue' | 'green' | 'purple' | 'red' | 'yellow' | 'blue'The color of the chip.
glyphReact.ReactElementAn icon glyph rendered before the text. To use a custom icon, see Link docs
disabledbooleanDetermines if the chip should be disabled.false
onDismissReact.MouseEventHandler<HTMLButtonElement>Callback when dismiss button is clicked. If set, a dismiss button will render.
dismissButtonAriaLabelstringaria-label for the dismiss button.${label} deselect
darkModebooleanRender the component in dark mode.false
...native span attributesAny other props will be spread on the root span element
3.0.9

9 months ago

2.0.0

1 year ago

3.0.12

8 months ago

3.0.4

10 months ago

3.0.13

7 months ago

3.0.3

10 months ago

3.0.10

8 months ago

3.0.2

11 months ago

3.0.11

8 months ago

3.0.1

11 months ago

3.0.8

9 months ago

3.0.7

9 months ago

3.0.6

9 months ago

3.0.5

10 months ago

3.0.0

11 months ago

4.0.0

7 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.2.1

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.1-popover.0

2 years ago

1.0.0

2 years ago