-
Notifications
You must be signed in to change notification settings - Fork 46
Build a New Component
Create something reusable that the Bolt Design System doesn't offer. Consider the following when building a new component.
Think about what you are building, is it for a specific page or layout? Can it work elsewhere? If you think it's reusable, go ahead and continue.
Pull down the master branch of Bolt and follow the official instructions.
BEM stands for block element modifier, the TL:DR is to name all your CSS as such: .block__element--modifier
. You can read more about it here.
In addition to using the BEM convention, also prefix it with .c-bolt-
.
.c-bolt-button { ... }
.c-bolt-button--primary { ... }
.c-bolt-button--secondary { ... }
.c-bolt-button__text { ... }
.c-bolt-button__text--uppercase { ... }
.c-bolt-button__text--capitalize { ... }
Always use classes for your CSS, do not just style generic HTML tags. The classes will encapsulate everything you define for the component and prevent them from bleeding into other things.
p {
font-size: 24px;
color: red;
}
.c-bolt-button > span {
background-color: red;
}
Think about customization, what options do your want to enable for the consumers? Some common options include color, spacing, and alignment. Create a schema for all the customization options.
Once you are done, you need to tell the Bolt team about it.
Write ticket and add it to the Bolt backlog.
By creating a pull request on Github, you will notify the Bolt team. Request one of the Bolt developers to review your code right in the Github interface.
- 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