Apps may configure settings which let users customize the app at the workspace level.
Settings are defined using a workspace settings schema at src/app.settings.ts and displayed with form components from useWorkspaceSettingsForm().
Unlike regular forms in dialogs, workspace settings forms automatically save changes and don’t require
a submit button or onSubmit handler. Each field saves individually:
- Text inputs and number inputs save
onBlur(when the user leaves the field) - Toggles, checkboxes, and comboboxes save
onChange(immediately when changed)
Only workspace admins can edit workspace settings. However, all workspace members can view the
settings.
Example: Basic workspace settings
First, define your settings schema. This must be in a file calledapp.settings.ts at src/app.settings.ts:
app.settings.ts
workspace-settings.tsx
app.ts:
app.ts
- Define a workspace settings schema at
src/app.settings.ts - Create a workspace settings object with a
Page - Use
useWorkspaceSettingsForm()to get form components - Wrap your settings inputs in the
<Form/>and organize with<Section/>components - Register the settings in your
app.ts
Validation
Unlike regular forms where validation is defined in the schema, workspace settings validation is specified directly on the input components:workspace-settings-validation.tsx
Available components
Workspace settings forms support the following components:Input components
<TextInput />- String input with validation<NumberInput />- Numeric input with min/max<Toggle />- Boolean toggle switch<Checkbox />- Boolean checkbox<Combobox />- Dropdown selection<AttioUserCombobox />- Select workspace users
Layout components
<Section />- Group settings into sections<InputGroup />- Group inputs horizontally
Utility components
<Button />- Action buttons for additional functionality<WithState />- Access form state for conditional rendering
Accessing settings in your app
Once your workspace settings are configured, you can access them in different ways:With real-time updates
In React components, use theuseWorkspaceSettings() hook to get settings that automatically update when changed:
widget.tsx
Programmatically
Use these functions to get and set settings. They’re available from bothattio/client (for use in React components, actions, etc.) and attio/server (for use in server functions):
In client code:
record-action.tsx
sync-data.server.ts
getWorkspaceSettings(), getWorkspaceSetting(), and setWorkspaceSetting() for more details.
Related documentation
- Workspace Settings Entry Point
useWorkspaceSettings()- Hook for accessing settings in React componentsgetWorkspaceSettings()- Get all settings in server actionsgetWorkspaceSetting()- Get a single setting in server actionssetWorkspaceSetting()- Set a single setting in server actionsuseWorkspaceSettingsForm()- Hook for creating the settings form- Workspace Settings Schema
- Settings Components