-
Notifications
You must be signed in to change notification settings - Fork 46
Utility Classes
Mike Mai edited this page May 6, 2021
·
9 revisions
Utilities are CSS classes that override pre-defined component styles.
{% include "@bolt/component-name.twig" with {
prop1: "string",
prop2: true,
attributes: {
class: [
"u-bolt-utility-name-1",
"u-bolt-utility-name-2"
]
}
} only %}
- Fully understand a specific component's props before turning to utilities as the last resort
- Use utilities to override a style that a component does not offer
- Use utilities to achieve something that's one off
{% include "@bolt/text.twig" with {
attributes: {
class: [
"u-bolt-color-indigo"
]
}
} only %}
- Use utilities to build something
<div class="u-bolt-padding-medium u-bolt-color-white u-bolt-background-color-indigo-dark u-bolt-font-size-xxxlarge u-bolt-text-align-center>
...
</div>
spacing: margin, padding
direction: top, right, bottom, left
options: xsmall, small, medium, large, xlarge
options: indigo, yellow, orange, teal, black, white, gray
options: right, left, center, justified
options: inline, inline-block, block, flex, inline-flex
options: grow, shrink, basis-auto
options: 0, 20, 40, 60, 80, 100
options: none, underline, line-through
- 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