5.2.11 • Published 2 years ago

bpk-component-chip-css v5.2.11

Weekly downloads
240
License
Apache-2.0
Repository
github
Last release
2 years ago

bpk-component-chip

Backpack chip component.

Installation

npm install bpk-component-chip --save-dev

Usage

import React from 'react';
import BpkSelectableChip, { BpkDismissibleChip, CHIP_TYPES } from 'bpk-component-chip';
import BeachIconSm from 'bpk-component-icon/sm/beach';

export default () => (

  <div style={{ display: 'flex' }}> // IMPORTANT: Flex styles make sure chips align with each other
    // Standard selectable chip.
    <BpkSelectableChip
      accessibilityLabel="Press to toggle chip"
      selected={false}
      onClick={() => { /* Use state to set 'selected={true}' */ }}
    >
      Toggle me
    </BpkSelectableChip>

    // Selectable chip with an icon.
    <BpkSelectableChip
      accessibilityLabel="Press to toggle chip"
      selected={false}
      onClick={() => { /* Use state to set 'selected={true}' */ }}
      leadingAccessoryView={<BeachIconSm />}
    >
      Toggle me
    </BpkSelectableChip>

    // Standard dismissible chip.
    <BpkDismissibleChip
      accessibilityLabel="Press to dismiss chip"
      onClick={() => { /* Use state to handle removing this chip. */ }}
    >
      Dismiss me
    </BpkDismissibleChip>

    // Dismissible chip with an icon.
      <BpkDismissibleChip
      accessibilityLabel="Press to dismiss chip"
      onClick={() => { /* Use state to handle removing this chip. */ }}
      leadingAccessoryView={<BeachIconSm />}
    >
      Dismiss me
    </BpkDismissibleChip>
  </div>
);

Props

BpkSelectableChip

PropertyPropTypeRequiredDefault Value
accessibilityLabelstringtrue-
childrennodetrue-
onClickfunctrue-
classNamestringfalsenull
disabledboolfalsefalse
leadingAccessoryViewnodefalsenull
selectedboolfalsefalse
trailingAccessoryViewnodefalsenull
typeoneOf(CHIP_TYPES.light, CHIP_TYPES.primary, CHIP_TYPES.success)

BpkDismissibleChip

Dismissible chips are selectable chips that have been preconfigured to have a 'close' icon trailing accessory view and cannot be selected, so they have the same props as BpkSelectableChip, minus trailingAccessoryView and selected.

PropertyPropTypeRequiredDefault Value
accessibilityLabelstringtrue-
childrennodetrue-
onClickfunctrue-
classNamestringfalsenull
disabledboolfalsefalse
leadingAccessoryViewnodefalsenull
typeoneOf(CHIP_TYPES.light, CHIP_TYPES.primary, CHIP_TYPES.success)

Theme Props

Primary

  • chipPrimarySelectedBackgroundColor
  • chipPrimarySelectedHoverBackgroundColor
  • chipPrimarySelectedActiveBackgroundColor
  • chipPrimarySelectedTextColor

Light

  • chipLightSelectedBackgroundColor
  • chipLightSelectedHoverBackgroundColor
  • chipLightSelectedActiveBackgroundColor
  • chipLightSelectedTextColor

Success

  • chipSuccessSelectedBackgroundColor
  • chipSuccessSelectedHoverBackgroundColor
  • chipSuccessSelectedActiveBackgroundColor
  • chipSuccessSelectedTextColor
5.2.11

2 years ago

5.2.9

2 years ago

5.2.7

2 years ago

5.2.5

2 years ago

5.2.4

2 years ago

5.2.2

2 years ago

5.2.1

2 years ago

5.1.26

2 years ago

5.1.23

2 years ago

5.1.21

2 years ago

5.1.20

2 years ago

5.1.14

2 years ago

5.1.12

2 years ago

5.1.11

2 years ago

5.1.9

3 years ago

5.1.3

3 years ago

5.1.0

3 years ago

5.0.16

3 years ago

5.0.14

3 years ago

5.0.11

3 years ago

5.0.12

3 years ago

5.0.13

3 years ago

5.0.10

3 years ago

5.0.9

3 years ago

5.0.8

3 years ago

5.0.7

3 years ago

5.0.6

3 years ago

5.0.5

3 years ago

5.0.4

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.2.6

3 years ago

4.2.8

3 years ago

4.2.5

3 years ago

4.2.4

3 years ago

4.2.3

3 years ago

4.2.2

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.40

3 years ago

4.1.39

3 years ago

4.1.38

3 years ago

4.1.37

3 years ago

4.1.36

3 years ago

4.1.34

3 years ago

4.1.33

3 years ago

4.1.32

3 years ago

4.1.31

3 years ago

4.1.30

3 years ago

4.1.28

3 years ago

4.1.29

3 years ago

4.1.27

3 years ago

4.1.26

3 years ago

4.1.25

3 years ago

4.1.24

3 years ago

4.1.22

3 years ago

4.1.23

3 years ago

4.1.20

3 years ago

4.1.21

3 years ago

4.1.19

3 years ago

4.1.18

3 years ago

4.1.17

3 years ago

4.1.16

3 years ago

4.1.15

3 years ago

4.1.14

3 years ago

4.1.13

3 years ago

4.1.12

3 years ago

4.1.11

3 years ago

4.1.10

3 years ago

4.1.9

3 years ago

4.1.8

3 years ago

4.1.7

3 years ago

4.1.6

3 years ago

4.1.4

3 years ago

4.1.5

3 years ago

4.1.1

3 years ago

4.1.0

4 years ago

4.0.19

4 years ago

4.0.18

4 years ago

4.0.17

4 years ago

4.0.15

4 years ago

4.0.14

4 years ago

4.0.12

4 years ago

4.0.13

4 years ago

4.0.11

4 years ago

4.0.10

4 years ago

4.0.9

4 years ago

4.0.7

4 years ago

4.0.6

4 years ago

4.0.5

4 years ago

4.0.0

4 years ago

3.3.2

4 years ago

3.3.1

4 years ago

3.2.21

4 years ago

3.2.20

4 years ago

3.2.19

4 years ago

3.2.18

4 years ago