{% include '@bolt-components-trigger/trigger.twig' with {
content: 'This is a trigger'
} only %}
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes
|
A Drupal-style attributes object with extra attributes to append to this component. |
object
| — |
|
content
|
Main content of the trigger (Twig only). |
string
, array
, object
|
— |
|
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
|
|
type
|
Determines the button tag type for semantic buttons |
string
|
button
|
|
rel
|
Set to |
string
| — |
|
cursor
|
Type of cursor shown on hover. |
string
|
pointer
|
|
on_click
|
When used with on_click_target, an event to fire on the targeted elements when this element is clicked. When used without on_click_target, arbitrary javascript to execute when this element is clicked. |
string
| — |
|
on_click_target
|
Requires on_click. A CSS selector for elements that the on_click event will fire on when this element is clicked. |
string
| — |
|
onClick
(deprecated) |
Use on_click instead. |
— | — |
|
onClickTarget
(deprecated) |
Use on_click_target instead. |
— | — |
|
display
|
Set the display property |
string
|
inline
|
|
no_outline
|
Turn off the default outline on focus |
boolean
|
false
|
|
disabled
|
Make trigger unusable and un-clickable. Only applies to |
boolean
|
false
|
|
npm install @bolt/components-trigger
<bolt-trigger>
element in the markup.
<bolt-trigger onclick="alert('Trigger clicked')">
This is a trigger
</bolt-trigger>
button
tag. Set the url
prop to render a semantic a
tag.
<bolt-trigger url="https://google.com">
This is a trigger
</bolt-trigger>
cursor
prop.
<bolt-trigger cursor="zoom-in">
This is a trigger
</bolt-trigger>
on-click
and on-click-target
props to call a method on another component. See schema for more info.
<bolt-trigger on-click="show" on-click-target="js-image-modal-456" cursor="zoom-in" display="block">
<bolt-image src="/images/placeholders/tout-4x3-climber.jpg" alt="A Rock Climber" ratio="640/480"></bolt-image>
</bolt-trigger>
<bolt-modal class="js-image-modal-456" spacing="none" theme="none" scroll="overall">
<bolt-trigger on-click="hide" on-click-target="js-image-modal-456" cursor="zoom-out" display="block">
<bolt-image src="/images/placeholders/tout-4x3-climber.jpg" alt="A Rock Climber" sizes="auto" ratio="640/480"></bolt-image>
</bolt-trigger>
</bolt-modal>