-
Notifications
You must be signed in to change notification settings - Fork 46
Standard Props for Passing Content in Twig
Mike Mai edited this page May 7, 2021
·
1 revision
content
/items
and attributes
are props that every template should have, except when a UI element doesn't have content, then content
or items
would not be applicable.
{% include '@bolt-[category]-[name]/[name].twig' with {
content: 'This is the content.'
attributes: {
'data-foo': 'bar'
}
} only %}
They are the standard props for passing content.
- When to use content: data is expected as anything (string, object, etc.)
- When to use items: data is expected as an array
This is the prop for passing any HTML attributes to the main container.
Trigger
and spacing
should be used when applicable.
{% include '@bolt-[category]-[name]/[name].twig' with {
spacing: 'medium',
trigger: 'This is the trigger.',
content: 'This is the content.',
attributes: {
'data-foo': 'bar'
}
} only %}
Certain UI elements require a trigger to activate the display of content, this is the prop for passing such a thing.
This is the prop for controlling spacing (margin and padding only) within a UI element's design. For example, the spacing between grid cells, list items, and the inset spacing of bands, cards, etc.
- Basic A11y Checklist
- Get started with Bolt locally
- Bolt Specific Standards and Conventions
- How to save SVG graphics and SVG icons
- Upgrade to minor release
- Upgrade to 4.x
- Upgrade to 5.x
- Release Workflow
- VS Code Configuration
- Bolt Doc Writing Guide
- Prefixing Custom Attributes
- Standard Props for Passing Content in Twig
- Building Websites with Bolt in Drupal
- From Design Mockup to Code
- Override with Utility Classes