Skip to content

CreateOrganization

<CreateOrganization> is the prebuilt organization-creation card: a single name field and a submit button, styled like the <SignIn> card. On submit it creates the organization and resolves to its summary.

It calls createOrganization under the hood, so the new org appears in useOrganizations().organizations once the session refreshes. Creating an org does not make it active — switch to it with switchActiveOrganization (or let the user pick it from <OrganizationList>).

For the full feature — roles, permissions, invitations, and dashboard setup — see Organizations & roles.

import { CreateOrganization, useOrganizations } from '@torii-js/torii-react';
function NewOrg() {
const { switchActiveOrganization } = useOrganizations();
return (
<CreateOrganization
onCreated={(org) => switchActiveOrganization(org.id)}
onError={(e) => console.error(e)}
/>
);
}

All optional: the card is fully wired by context.

Prop Type Description
onCreated (organization: ClientOrganizationSummary) => void Fired after the org is created, with its { id, name, role } summary. The new org is not active yet — switch to it here if you want it active.
onError (error: Error) => void Fired when creation fails (e.g. a blank name or a server error).
  • Name only. Organizations are created with a name; a URL slug is assigned automatically server-side.
  • Runtime-gated: renders null until the SDK runtime is ready, so it never flashes unstyled.

Honours the appearance prop on <ToriiProvider>. Relevant slots: card, formButtonPrimary, formFieldInput. See elements.