rw.theme
The rw.theme object provides access to theme configuration, including responsive breakpoints.
Properties
Property
Type
Description
breakpoints.names
Array
Breakpoint names (e.g., ["sm", "md", "lg", "xl", "2xl"])
breakpoints.screens
Object
Breakpoint widths in pixels
Accessing Theme Data
const transformHook = (rw) => {
const { breakpoints } = rw.theme;
const { names, screens } = breakpoints;
console.log(names); // ["sm", "md", "lg", "xl", "2xl"]
console.log(screens); // { sm: 640, md: 768, lg: 1024, xl: 1280, "2xl": 1536 }
};
exports.transformHook = transformHook;Responsive Image Sources
A common use case is generating responsive image sources based on breakpoints:
Using Breakpoints for Conditional Logic
Building Media Query Classes
Using in Templates
Last updated
Was this helpful?

