rw.responsiveProps

The rw.responsiveProps object contains property values that vary by breakpoint. When a property is marked as responsive in properties.json, its per-breakpoint values are accessible here.

Accessing Responsive Properties

const transformHook = (rw) => {
    const { imageFileSize, columnCount } = rw.responsiveProps;
    
    // Each responsive property is an object with breakpoint keys
    console.log(imageFileSize);
    // { base: 400, sm: 600, md: 800, lg: 1200 }
    
    console.log(columnCount);
    // { base: 1, md: 2, lg: 3 }
};

exports.transformHook = transformHook;

Structure

Responsive properties are objects keyed by breakpoint name:

{
    base: value,    // Default/mobile value
    sm: value,      // Small screens
    md: value,      // Medium screens
    lg: value,      // Large screens
    xl: value,      // Extra large screens
    "2xl": value    // 2X large screens
}

Only breakpoints with explicitly set values are included.

Example: Responsive Image Sizing

Example: Responsive Hidden States

Combining with Regular Props

Responsive props complement regular props - use rw.props for non-responsive values and rw.responsiveProps for breakpoint-specific values:

Last updated

Was this helpful?