Skip to content

Configuration

This section will help you to right configure the module for your project.

$screens

You can override existing values or add new ones to extend the default sizes list.

scss
@use "@unsass/breakpoint" with (
    $screens: (
        "lg": 1024px
    )
);
scss
@use "@unsass/breakpoint" with (
    $screens: (
        "3xl": 1920px
    )
);

Default tokens

KeyValueDescription
xs360pxExtra small screen.
sm480pxStandard mobile screen.
md768pxmobile on landscape mode or tablet on portrait mode.
lg960pxDesktop or tablet on landscape mode.
xl1200pxLarge desktop screen.
2xl1400pxExtra large desktop screen.

$reset

Clears the default $screens configuration to provide a clean slate for defining your own custom tokens.

scss
@use "@unsass/breakpoint" with (
    $reset: true,
    $screens: (
        "tablet": 768px,
        "desktop": 960px
    )
);

config($screens, $reset)

The following Sass will configure new parameters:

scss
@use "@unsass/breakpoint";

@include breakpoint.config((
    "lg": 1024px
));

INFO

If variables are already configured on top-level using @use ... with, by another dependency, for example, you can't use this solution anymore. This is because the module can only be set up once, this is a Sass restriction with Module System, but another solution exists for override the main configuration, with a mixin!

See official documentation about override configuration with mixins.