Docs / workspaces / useWorkspace

useWorkspace

hooknot for built apps

List, create, and select workspaces for the current user.

import { useWorkspace } from 'flowstack-sdk'

Signature

const { workspaces, selectedWorkspace, isLoading, error, createWorkspace, selectWorkspace, refreshWorkspaces } = useWorkspace()

Returns

FieldTypeDescription
workspacesWorkspaceInfo[]Available workspaces.
selectedWorkspaceWorkspaceInfo | nullThe currently selected workspace.
isLoadingbooleanRequest in flight.
errorstring | nullLast error message.
createWorkspace(name, description?) => Promise<WorkspaceInfo | null>Create a new workspace.
selectWorkspace(workspace) => voidSet the active workspace.
refreshWorkspaces() => Promise<void>Re-fetch the workspace list.

Examples

Workspace management
const {
  workspaces,        // WorkspaceInfo[]
  selectedWorkspace, // WorkspaceInfo | null
  isLoading,         // boolean
  error,             // string | null
  createWorkspace,   // (name, description?) => Promise<WorkspaceInfo | null>
  selectWorkspace,   // (workspace) => void
  refreshWorkspaces, // () => Promise<void>
} = useWorkspace();

See also

useUserManagement

Source: README.md#useworkspace · Also available in llms-full.txt and registry.json.