-
Notifications
You must be signed in to change notification settings - Fork 45
API Formats
Mike Mai edited this page Jul 31, 2018
·
14 revisions
Topic | Guidelines |
---|---|
Boolean | Try to use the predefined boolean words |
String | Use the predefined conventions for levels and hierarchy |
Value of None | Don't use null and undefined
|
Try to use the following when creating booleans.
Positive Boolean | Negative Boolean | Neutral Boolean |
---|---|---|
indeterminate | ||
loop | unloop | |
autoplay | noautoplay | |
checked | unchecked | |
enabled | disabled | |
active | inactive | |
selected | unselected | |
toggled | untoggled | |
interactive | nointeractive | |
styled | unstyled | |
clicked | unclicked | |
rounded | unrounded |
If it's boolean, use boolean. If it's more than just true or false, use string.
{% include "@bolt/component-name.twig" with {
rounded: "rounded"
} %}
Use x
to indicate levels.
For theme names, we use a range of light and dark:
- xlight
- light
- dark
- xdark
For size or breakpoint names, we use a range of small and large:
- xxsmall
- xsmall
- small
- medium
- large
- xlarge
- xxlarge
Use the following to indicate hierarchy:
- color: primary
- color: secondary
- color: tertiary
Use @
to indicate responsive behaviors.
- width: full
- width: full@small
- width: full@medium
- width: full@large
theme:
type: string
title: 'Theme'
description: 'Color theme options.'
default: xlight
enum:
- xlight
- light
- dark
- xdark
- none
In the above example, to truly remove theme, one has to explicitly set it to none. Since that's not boolean, true, false, and null would not work, only values from the schema would work. But these values won't be invalid, they will just return the schema default.
The following is invalid, don't do it.
{% include "@bolt/component-name.twig" with {
prop1: null,
prop2: ""
} %}
- 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