Enable custom components
You can use the Plaza theme to create themes with our React components library, which is included in the Storefront Toolkit as of version 2.0.5. To create custom components, ensure that your theme is the current Toolkit default, and use the following sfb-toolkit commands on the command line:
sfb-toolkit componentssfb-toolkit storybook
These commands are discussed in more detail below.
If you have recently upgraded your Toolkit to version 4.0 from an earlier version, you may receive warnings and error messages related to custom components when you start it. For instructions on how to resolve these warnings and errors, see Upgrading to 4.0 and later.
Enable custom components for a theme
Run the following command to enable theme developers to build custom components in their current theme:
sfb-toolkit components
When you run the command, the toolkit:
- Installs the latest
@appdirect/sfb-theme-componentsin your current theme. - Creates a
customComponentsfolder in your current theme with twoAtomsShowcasecomponents as examples. - Bundles both
sfb-theme-componentsand custom components into one package in the current theme assets folder.
By default, the sfb-theme-components library is bundled and deployed in a CDN (Content Delivery Network) and referenced in your theme. To use custom components, sfb-theme-components are bundled together with the user-defined custom components into a single package.
Therefore, when you run sfb-theme-components, the toolkit creates a customComponents folder in your current theme where you can start building custom components. Then, when you start your sfb-toolkit server with the sfb-toolkit start command and you make a change inside your customComponents folder, the toolkit bundles your components into a single package and puts it in your theme assets folder so you can preview the changes in your browser using hot module replacement.