Skip to main content

What Are Collections?

Collections are a personal bookmarking system built into Sublay. Each authenticated user has a private library of named folders — called collections — where they can save entities for later reference.
Requires the collections bundle. Collections are only available when the collections bundle is installed on your project. See Bundles to add it.
Collections are hierarchical: every user starts with a root collection and can create unlimited sub-collections nested inside it or inside each other.
Collections are private. They belong to and are only visible to the user who created them.

How It Works

  1. Root collection — automatically created the first time a user accesses their collections. Acts as the top-level folder and cannot be renamed or deleted.
  2. Sub-collections — folders created inside the root or inside other sub-collections. Can be renamed and deleted.
  3. Entities — saved into the current collection. The same entity can appear in multiple collections.

Hooks

useCollections

Navigate the collection hierarchy and perform CRUD operations on the current collection context.

useCollectionsActions

Lower-level actions for fetching, creating, updating, and deleting collections.

useCollectionEntitiesWrapper

Fetch paginated entities saved in a specific collection with sort and load-more support.
To check whether a specific entity is saved in any of the user’s collections, see useIsEntitySaved in the entities section.

Data Model

See Collection for the full field reference.