Collections in properties.json

Display collections in the component inspector

After creating your collection folder structure, you need to register it in your component's main properties.json file. This makes the collection appear in the inspector panel alongside your other component controls.

Syntax

Add a collection reference using the collection control type:

{
    "title": "Collection Title",
    "property": "collectionName",
    "collection": {
        "identifier": "com.company.component.collections.name"
    }
}

Parameters

Property
Required
Description

title

Yes

Display name shown in the inspector

property

Yes

The property name used to access the collection in templates

collection.identifier

Yes

Must match the identifier in your collection's info.json

Examples

Basic Collection Reference

Add a features collection to your component:

Tags Collection with Icon

The Grid, Flex, and Container components use a tags collection for filtering:

Audio Playlist Tracks

The Audio Playlist component registers its tracks collection:

Multiple Collections

Components can have multiple collections. Each gets its own group for clarity:

Place collection controls alongside related settings:

Accessing Collection Data

Once registered, the collection data is available:

  • In templates: collections.{property} (e.g., collections.features)

  • In hooks.js: rw.collections.{property} (e.g., rw.collections.features)

See Accessing Data in Templates and Data Collections in hooks.js for usage details.

Best Practices

  1. Use descriptive property names - The property name becomes part of the template syntax, so make it clear and concise.

  2. Add appropriate icons - Use SF Symbols that represent the collection content (e.g., music.note for tracks, tag for tags).

  3. Group collections logically - Place collections in dedicated groups or alongside related controls.

  4. Match identifiers exactly - The identifier must match your collection's info.json exactly, including case.

Last updated

Was this helpful?