EntityProvider is the standard way to load and work with a single entity. Wrap a component tree with it, then use useEntity in any descendant to access the entity’s data and actions.
Setting Up EntityProvider
EntityProvider accepts one of four mutually exclusive identifier props:
1
By Sublay entity ID
2
By foreign ID
Use this when your entity is linked to an item in your own system. Pass
createIfNotFound to auto-create the entity if it doesn’t exist yet.3
By short ID
Short IDs are auto-generated by Sublay and are useful for short sharing URLs.
4
By passing an entity object
If you already have the full entity object (e.g., from a list), pass it directly to skip the initial fetch.
EntityProvider renders null if none of the identifier props are provided. Exactly one must be present.Accessing Entity State with useEntity
Inside any child of EntityProvider, call useEntity() to access the entity and its actions:
useEntity Return Values
Direct state setter. Use this if you need to manually update the local entity state.
Updates the entity and syncs the new state locally. Accepts:
title— new titlecontent— new contentattachments— array of attachment objectskeywords— array of keyword stringslocation—{ latitude, longitude }metadata— arbitrary JSON objectmentions— array ofMentionobjects
EntityProvider Props Reference
A pre-fetched entity object. Pass this to avoid a redundant fetch. Mutually exclusive with the others.

