Give a fresh new look to any component β replace the default styles with your own.
In the first few chapters, we looked at how global styles can be overridden in Scandi. However, for better code organization, individual components have their own styles, too. In this chapter, you will learn to override a component's styles.
Suppose you want to completely re-style an existing component in Scandi. All you need to do is override its .style.scss file by creating a new file of the same path, in your theme directory. For example:
to override:
node_modules/@scandipwa/scandipwa/
src/component/ProductAttributes/ProductAttributes.style.scss
create:
src/component/ProductAttributes/ProductAttributes.style.scss
You can also use the scandipwa CLI utility to override styles more easily. Just be sure to select Override when asked what to do with styles, and leave the other options un-selected.
scandipwa override component ProductAttributes
? Choose things to extend in ProductAttributes.component.js
? What would you like to do with styles? Override
? Choose things to extend in ProductAttributes.container.js
NOTE!
The following files have been created:
src/component/ProductAttributes/ProductAttributes.style.scss
Now, it's time to write some custom styling for the component: