Wocha Docs

CreateOrganization

Standalone organisation creation form using the Customer API.

The <CreateOrganization> component renders a form for creating a new organisation. It calls POST /v1/organisations via the Customer API using the signed-in user's access token.

Installation

pnpm add @wocha/ui @wocha/react
Or scaffold with the CLI
npx @wocha/cli init --framework nextjs
import { CreateOrganization } from "@wocha/ui";
import "@wocha/ui/styles.css";

Basic usage

<CreateOrganization
  onSuccess={(org) => console.log("Created", org.id)}
  afterCreateUrl="/dashboard"
/>

Props

PropTypeDefaultDescription
appearanceWochaAppearanceVisual customisation
classNamestringAdditional class name
onSuccess(org: { id, name, slug }) => voidCalled after successful creation
onError(error: Error) => voidCalled when creation fails
afterCreateUrlstringRedirect URL after successful creation

Theming

<WochaThemeProvider appearance={{ signIn: { radius: "lg" } }}>
  <CreateOrganization />
</WochaThemeProvider>

Framework notes

Requires apiUrl on WochaProvider or WochaSessionProvider. User must be signed in.

FrameworkProvider
React SPAWochaProvider with apiUrl in config
Next.jsWochaSessionProvider with apiUrl prop

On this page