Mixins API
This section provides comprehensive guidance on how to effectively use breakpoint mixins for managing responsive CSS and maintaining consistency throughout your project.
up($token)
Applies a media query rule for minimum width only, focusing on devices with screen sizes equal to or larger than the specified breakpoint.
@use "@unsass/breakpoint";
.foo {
@include breakpoint.up("lg") {
color: darkcyan;
}
}
@media (min-width: 960px) {
.foo {
color: darkcyan;
}
}
down($token)
Applies a media query rule for maximum width only, focusing on devices with screen sizes smaller than the specified breakpoint.
@use "@unsass/breakpoint";
.foo {
@include breakpoint.down("lg") {
color: darkcyan;
}
}
@media (max-width: 959px) {
.foo {
color: darkcyan;
}
}
only($token)
Applies a media query rule for a specific breakpoint range, automatically setting the minimum width to the specified token and the maximum width to just before the next breakpoint value.
@use "@unsass/breakpoint";
.foo {
@include breakpoint.only("lg") {
color: darkcyan;
}
}
@media (min-width: 960px) and (max-width: 1199px) {
.foo {
color: darkcyan;
}
}
between($token)
Applies a media query rule for a custom range between two specified breakpoints, allowing precise control over the minimum and maximum widths.
@use "@unsass/breakpoint";
.foo {
@include breakpoint.between("md", "xl") {
color: darkcyan;
}
}
@media (min-width: 768px) and (max-width: 1199px) {
.foo {
color: darkcyan;
}
}