Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

bpk-component-chip

Package Overview
Dependencies
Maintainers
7
Versions
454
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpk-component-chip

Backpack chip component.

latest
Source
npmnpm
Version
6.1.2
Version published
Maintainers
7
Created
Source

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

FAQs

Package last updated on 30 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts