Requires the
spaces bundle. Spaces are only available when the spaces bundle is installed on your project (space-level chat additionally needs the chat bundle). See Bundles to add it.In This Section
Provider & Hook
Load a space into context and access its state and operations
Membership
Join/leave spaces, approval workflows, role management
Moderation
Approve or remove content, handle member and content reports
Rules
Create and display space rules for members
Space Lists
Browse and paginate spaces with filtering and sorting
Core Architecture
Spaces follow the provider + hook pattern used throughout Sublay. Wrap your space UI with aSpaceProvider and access everything via useSpace.
Permission Model
Each space has two independent permission settings:readingPermission—"anyone"or"members". Controls who can see content.postingPermission—"anyone","members", or"team"(the space’s active admins and moderators). Controls who can post.
useSpace exposes the current user’s resolved permissions (canPost, canRead, canModerate, isAdmin, isModerator) from the space’s memberPermissions, which the server always returns, for members, non-members and signed-out users alike. The server works them out from these settings, the spaces above, bans and the user’s membership (see How permissions are calculated); the SDK never guesses them.
Separately, each space has a visibility setting — "public" (default), "unlisted", or "private" — that controls who can find and see the space, independent of the permission model above:
"unlisted"keeps a space out of the directory and search, and out of sub-space lists for non-members, but anyone who can see the space above it reaches it by id, short id or slug."private"makes a space seen only by its active members. Everyone else — including users with a pending, banned or rejected membership, and a service key withoutactingUserId— gets404, as if it didn’t exist, and so do the spaces under it (unless they are a member of one of those). A private space can’t be joined: its moderators and admins add its members withuseAddMember.- Listings show a space only if it and every space above it are
"public". Where a space the viewer can’t see would be embedded (parentSpace, an entity’sspace), it isnull.
Hierarchy
Spaces can be nested up to 10 levels deep. A child space is created by passing aparentSpaceId to useCreateSpace. Only admins of the parent space can create child spaces. Parent admins and moderators are automatically cascaded into new child spaces with their existing roles.
The space directory lists top-level spaces by default. Pass a space id as parentSpaceId to list that space’s direct sub-spaces, or "any" to list spaces at every level. See Space Lists.

