chip docs

2.18.1

Chip

Chip Component in Bolt

Pill like container for displaying meta data text. Part of the Bolt “Components” CSS framework that powers the Bolt Design System.

Install via NPM
npm install @bolt/components-chip
  {% include "@bolt-components-chip/chip.twig" with {
  text: "This is a chip",
  url: "#!",
} only %}

Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case.

Prop Name Description Type Default Value Option(s)
Attributes

A Drupal attributes object. Used to apply with extra HTML attributes to the outer <bolt-chip> tag.

object
Text *

Text content of the chip.

string , array , object
Size

Controls the size of the chip.

string small
  • xsmall, small, medium
Url

Optional. Contains a URL that the chip points to. When URL is present, tag changes to a, otherwise tag would be span.

string
Target

Specifies where to display the linked URL. This may also be passed as part of attributes.

string
Icon

Bolt icon. Accepts the same options as Bolt Icon Component @bolt-components-icon plus an additional 'position' parameter that determines placement within the button.

object
  • @bolt-components-icon/icon.schema.json > Object details
    • attributes

      A Drupal-style attributes object with extra attributes to append to this component.

      Type: object

    • name

      Icon name

      Type: string

    • background

      Customizes the background that's displayed behind the SVG icon itself. Choosing any option other than none will automatically add a bit of space around the SVG so the background has the necessary space. Note, this option is now available to icons of all sizes!

      Type: string

      • none, circle, square
    • size

      Icon size.

      Type: string

      • small, medium, large, xlarge
    • color

      Icon color palette. Picking an option other than auto will override the default colors based on the color theme is placed within.

      Type: string

      • auto, teal, blue, indigo, yellow, orange, gray, green, white, pink
Tag

DEPRECATED - tag is automatically determined by URL.

Open Accordion Close Accordion
No_shadow

Manually disables the component from rendering to the Shadow DOM in a Twig template. Useful for testing cross browser functionality / rendering behavior. By default this is handled globally based on browser support.

boolean
No-shadow

Manually disables the web component from rendering to the Shadow DOM. Useful for testing cross browser functionality / rendering behavior. By default this is handled globally based on browser support.

boolean

chip

Chip

chip url variations

chip size variations

Size xsmall small medium

chip icon variations

Icon Icon before Icon after
Web Component Usage Bolt Chip is a web component, you can simply use <bolt-chip> in the markup to make it render.
Chip
<bolt-chip> Chip </bolt-chip>
Basic Usage All the props defined in the schema table can be used directly on the <bolt-chip> element.
Linked chip
<bolt-chip spacing="small" url="https://pega.com" target="_blank"> Linked chip </bolt-chip>
Advanced Usage To add icons to <bolt-chip>, place a <bolt-icon> next to your chip text. For icons to have the correct spacing, you must add the slot attribute to <bolt-icon>. The slot value can be before or after.
Chip with icon
<bolt-chip> Chip with icon <bolt-icon name="check" slot="after"></bolt-icon> </bolt-chip>
Debug Panel