bpk-component-chip-css

5.2.11 • Public • Published

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

Property PropType Required Default Value
accessibilityLabel string true -
children node true -
onClick func true -
className string false null
disabled bool false false
leadingAccessoryView node false null
selected bool false false
trailingAccessoryView node false null
type oneOf(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.

Property PropType Required Default Value
accessibilityLabel string true -
children node true -
onClick func true -
className string false null
disabled bool false false
leadingAccessoryView node false null
type oneOf(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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.2.112latest

Version History

VersionDownloads (Last 7 Days)Published
5.2.112
5.2.90
5.2.70
5.2.50
5.2.40
5.2.20
5.2.10
5.1.260
5.1.230
5.1.210
5.1.200
5.1.140
5.1.120
5.1.110
5.1.90
5.1.30
5.1.00
5.0.160
5.0.140
5.0.130
5.0.120
5.0.110
5.0.100
5.0.90
5.0.80
5.0.70
5.0.60
5.0.50
5.0.40
5.0.30
5.0.20
5.0.10
5.0.00
4.2.80
4.2.60
4.2.50
4.2.40
4.2.30
4.2.20
4.2.11
4.2.00
4.1.400
4.1.390
4.1.380
4.1.370
4.1.360
4.1.340
4.1.330
4.1.320
4.1.310
4.1.300
4.1.290
4.1.280
4.1.270
4.1.260
4.1.250
4.1.240
4.1.230
4.1.220
4.1.210
4.1.201
4.1.190
4.1.180
4.1.170
4.1.160
4.1.150
4.1.140
4.1.130
4.1.120
4.1.110
4.1.100
4.1.90
4.1.80
4.1.70
4.1.60
4.1.50
4.1.40
4.1.10
4.1.00
4.0.190
4.0.180
4.0.170
4.0.150
4.0.140
4.0.130
4.0.120
4.0.110
4.0.100
4.0.91
4.0.70
4.0.60
4.0.50
4.0.00
3.3.20
3.3.10
3.2.210
3.2.200
3.2.190
3.2.180

Package Sidebar

Install

npm i bpk-component-chip-css

Weekly Downloads

5

Version

5.2.11

License

Apache-2.0

Unpacked Size

54.5 kB

Total Files

16

Last publish

Collaborators

  • k0nserv
  • shaundon
  • georgegillams
  • tiagohngl
  • ojcurt