Styling the layout and breakpoints
Breakpoints
FastStore simplifies screen breakpoint customization for projects by using Include-Media, a Sass library for writing CSS media queries in an easy and maintainable way, using a natural and simplistic syntax. Each project has the following five pre-defined screen breakpoints:
Customizing Breakpoints
Follow the steps below to override the pre-defined sizing system for the screen breakpoints.
Modifying these breakpoints implies changes to certain global tokens. See Grid & Layout for more details.
- Go to the
src
folder and create thestyles
folder inside it. You can run the following command to create it:
macOS and Linux
Windows
- Inside the
styles
folder, create a new file calledcustom-mixins.scss
macOS and Linux
Windows
- Add the following code snippet into the file:
You need to declare all the variants (phone, phonemid, tablet, notebook, and desktop) even when changing only one of the values.
- Run
yarn dev
in the terminal to start the development server. You should be able to see the changes.
Mixins
The Sass
@mixin
allows you to define styles that can be re-used throughout your application. Within FastStore projects, these mixins are categorized into three groups: Global Mixins
, Layout & Spacing Mixins
, and Focus Ring Mixins
.Global Mixins
Layout & Spacing Mixins
Focus Ring Mixins
Customizing Mixins
Overriding the predefined mixins follows a process similar to the customizing breakpoints steps. If you already have a
custom-mixin.scss
file, you can skip to Step 3. Otherwise, follow the steps below:- Go to the
src
folder and create thestyles
folder inside it. You can run the following command to create it:
macOS and Linux
Windows
- Inside the
styles
folder, create a new file calledcustom-mixins.scss
macOS and Linux
Windows
- Choose the mixin you want to override and add it to the file:
This code will make the following changes on the default
@mixin input-focus-ring
:
- Run
yarn dev
to start the development server.
You should see that all components that use the
focus-ring
now have a red shadow when focused. Click on the input to see the change.