Nasaq
Components

WorkspaceSettings

Create and manage workspaces. A first-run onboarding page, a create dialog for the workspace switcher, a list of your workspaces, and a settings page with rename, address, picture, leave and type-to-confirm delete.

PreviewOpen ↗

Code

<WorkspaceOnboarding  slugPrefix="nasaq.app/"  checkSlug={(slug) => api.slugAvailable(slug)}  onSubmit={(v) => api.createWorkspace(v)}/><WorkspaceSettings  workspace={{ name: "Sahab Studio", slug: "sahab" }}  canLeave={!isLastOwner}  onRename={(v) => api.rename(v)}  onLeave={() => api.leave()}  onDelete={() => api.remove()}/>

Account · beta

Live examples and controls: WorkspaceSettings in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/workspace-settings.json

Everything around the life of a workspace: the first one you create, the list of the ones you belong to, and the page where an owner renames, re-addresses, leaves or deletes one.

When to use

  • First run of a signed-in person who has no workspace (WorkspaceOnboarding).
  • The "Add workspace" item of WorkspaceSwitcher (CreateWorkspaceDialog).
  • A workspace settings page (WorkspaceSettings) and a "your workspaces" page (WorkspaceList).

When not to use

  • Managing the people in it: use MembersManager.
  • Personal account settings: use AccountSettings.

Import

import { WorkspaceOnboarding, WorkspaceSettings } from "@fadymondy/nasaq/web";

Quick start

<WorkspaceOnboarding
  slugPrefix="nasaq.app/"
  checkSlug={(slug) => api.slugAvailable(slug)}
  onSubmit={(v) => api.createWorkspace(v)}
/>

<WorkspaceSettings
  workspace={{ name: "Sahab Studio", slug: "sahab" }}
  canLeave={!isLastOwner}
  onRename={(v) => api.rename(v)}
  onLeave={() => api.leave()}
  onDelete={() => api.remove()}
/>

Anatomy

WorkspaceOnboarding (AuthLayout or bare)  -> CreateWorkspaceForm   data-slot="create-workspace-form"
CreateWorkspaceDialog                     -> Dialog + CreateWorkspaceForm
WorkspaceList                             data-slot="workspace-list"
WorkspaceSettings                         data-slot="workspace-settings"
├─ SettingsSection General   picture, name, address
├─ SettingsSection Leave     confirm dialog; disabled with a reason for the last owner
└─ DangerZone Delete         type the workspace name to confirm

API

PropComponentDescription
onSubmit(values)form, onboarding, dialog{ name, slug }; resolve { error?, fieldErrors? } to show a failure.
checkSlug(slug)form, onboarding, dialog, settingsboolean or { available, message? }; debounced and only for a valid address.
slugPrefixsameLeft-to-right text before the address, for example nasaq.app/.
showSlugform, dialogHide the address field. The dialog hides it by default.
bareonboardingRender without AuthLayout.
workspaces, onOpen, onCreatelistItems are { id, name, slug?, logo?, role?, members?, current? }.
workspace, canEdit, canDelete, canLeavesettings
onRename, logo, onLeave, onDeletesettingsEach section shows only when its handler is passed.
labelsallEnglish and Arabic built in.

The address follows the name until edited; an Arabic-only name gives an empty address the person fills in.

Examples

  • Switcher: <CreateWorkspaceDialog open={open} onOpenChange={setOpen} onSubmit={create} /> opened from WorkspaceSwitcher's onCreate.

Accessibility

Errors are tied to their fields; availability is announced in a status region and never by colour alone. Leave and delete are alert dialogs.

RTL & i18n

Addresses and prefixes are always left-to-right. The leave icon mirrors. Counts use locale digits.

Styling & tokens

Built on SettingsSection, DangerZone, Field and InputGroup; follows the tokens.

Do / Don't

  • Do verify the address on the server; the check here is a hint.
  • Do not delete without the typed confirmation.

Lab

https://docs.nasaqui.com/?path=/docs/components-account-workspace-settings--docs

On this page