For the complete documentation index, see llms.txt. This page is also available as Markdown.

rw.component

The rw.component object provides metadata about the component itself, including paths to assets.

Properties

Property
Type
Description

title

String

The component's name

group

String

The component group/category

version

Integer

Component version number

build

Integer

Component build number

assetPath

String

Path to component-specific assets

siteAssetPath

String

Path to site-level component assets

sharedAssetPath

String

Path to shared pack assets

Accessing Component Data

const transformHook = (rw) => {
    const {
        title,
        assetPath,
        sharedAssetPath
    } = rw.component;

    console.log(title);           // "Image Gallery"
    console.log(assetPath);       // "/resources/components/gallery/"
    console.log(sharedAssetPath); // "/resources/shared/"
};

exports.transformHook = transformHook;

Using Asset Paths

Asset paths are essential for referencing component resources like images, scripts, and stylesheets:

Placeholder Images in Edit Mode

A common pattern is showing placeholder images while editing:

Using in Templates

Last updated

Was this helpful?