{% include '@bolt-components-chip/chip.twig' with {
text: 'This is a chip',
url: 'https://google.com',
} only %}
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
|
|
border_radius
|
Controls the border radius of the chip. |
string
|
full
|
|
color
|
Controls the color of the chip. |
string
|
auto
|
|
url
|
Optional. Contains a URL that the chip points to. When URL is present, tag changes to |
string
| — |
|
target
|
A valid HTML target attribute to modify the behavior when clicking this element. Only valid when "url" is also present. |
string
|
_self
|
|
icon
|
Bolt icon. Accepts the same options as Bolt Icon Element |
object
| — | |
rel
|
Set to |
string
| — |
|
tag
|
DEPRECATED - tag is automatically determined by URL. |
— | — |
|
iconOnly
|
Display only the icon and hide the text. For accessibility purposes you are still required to provide text. |
boolean
|
false
|
|
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
| — |
|
npm install @bolt/components-chip
{% include '@bolt-components-chip/chip.twig' with {
text: 'This is a chip',
} only %}
<bolt-chip>This is a chip</bolt-chip>
{% include '@bolt-components-chip/chip.twig' with {
text: 'This is a linked chip',
url: 'https://google.com',
target: '_blank',
rel: 'noopener'
} only %}
<bolt-chip url="https://google.com" target="_blank" rel="noopener">This is a linked chip</bolt-chip>
{% include '@bolt-components-chip/chip.twig' with {
text: 'This is a medium chip',
size: 'medium',
} only %}
<bolt-chip size="medium">This is a medium chip</bolt-chip>
{% include '@bolt-components-chip/chip.twig' with {
text: 'This chip has small border radius',
border_radius: 'small',
} only %}
<bolt-chip border-radius="small">This chip has small border radius</bolt-chip>
// Regular chip with icon
{% include '@bolt-components-chip/chip.twig' with {
text: 'Chip with icon',
icon: {
name: 'lock',
position: 'after',
},
} only %}
// Icon-only chip
{% include '@bolt-components-chip/chip.twig' with {
text: 'Chip with icon',
icon: {
name: 'lock',
},
iconOnly: true,
} only %}
// Regular chip with icon
<bolt-chip><span slot="before"><!-- Icon or image markup --></span>Chip with icon</bolt-chip>
// Icon-only chip
<bolt-chip icon-only><span slot="before"><!-- Icon or image markup --></span>Chip with icon</bolt-chip>
color
is null or set to auto
, the default design has a semi-transparent background that works across all color themes; when color
is set to a specific color, the chip will always render in that color.{% include '@bolt-components-chip/chip.twig' with {
text: 'Colored chip',
color: 'teal',
} only %}
<bolt-chip color="teal">Colored chip</bolt-chip>