Viewport

Viewport tokens define breakpoints tied to the device screen sizes at which a component's behavior or rendering may change.

UIC is following a mobile-first approach. This means that we treat the smallest viewport size as a default one. Other viewports are used to override the mobile styles.

There is no native support for custom media queries in CSS, so we expose them using the PostCSS custom media plugin.

--uic-viewport-m
--uic-viewport-l
--uic-viewport-xl
/* Usage */
.element {
background: var(--uic-color-background-neutral);
}
@media (--uic-viewport-m) {
.element {
background: var(--uic-color-background-primary);
}
}

If you still want to make an exception for the mobile viewport, we still expose the small screen media query.

--uic-viewport-s

Some of the components support responsive properties syntax in JSX code. For example, you can check View utility with multiple responsive properties supported.

Previous