Organization Components

3 Components

Pre-built, customizable components for organization management. Drop-in UI for profiles, creation forms, and organization switching.

Quick Start

All organization components are available from the SDK. Wrap your app with SylphxProvider for automatic organization context.
Installation
import {
  OrganizationProfile,
  CreateOrganization,
  OrganizationList,
} from '@sylphx/platform-sdk/react'

OrganizationProfile

A complete organization profile management component with logo upload, name editing, and settings. Handles all update operations automatically.

Accessible
Themeable
Logo Upload
Basic Usage
import { OrganizationProfile } from '@sylphx/platform-sdk/react'

export default function SettingsPage() {
  return (
    <div className="max-w-2xl mx-auto py-8">
      <h1 className="text-2xl font-bold mb-6">Organization Settings</h1>
      <OrganizationProfile
        onUpdate={(org) => {
          toast.success('Organization updated!')
        }}
      />
    </div>
  )
}

Props

PropertyTypeDescription
onUpdate(org: Organization) => voidCallback fired after organization update
onError(error: Error) => voidCallback fired on update error
showLogoboolean= trueShow logo upload section
showNameboolean= trueShow organization name field
showSlugboolean= trueShow URL slug field
showDescriptionboolean= trueShow description field
showWebsiteboolean= trueShow website URL field
showSettingsboolean= trueShow organization settings
showDangerZoneboolean= falseShow danger zone with delete option
allowSlugChangeboolean= falseAllow changing the URL slug
maxLogoSizenumber= 5242880Max logo file size in bytes
acceptedImageTypesstring[]= ["image/jpeg", "image/png", "image/webp"]Accepted image MIME types
requiredRoleOrganizationRole= "admin"Minimum role required to edit
layout"card" | "flat"= "card"Visual layout style
themeThemeVariablesCustom theme overrides
classNamestringAdditional CSS classes

Advanced Examples

<OrganizationProfile
  showLogo={true}
  showName={true}
  showSlug={true}
  showDescription={true}
  showWebsite={true}
  showSettings={true}
  showDangerZone={true}
  requiredRole="super_admin"
  onUpdate={(org) => {
    analytics.track('organization_updated', {
      orgId: org.id,
      changes: Object.keys(org),
    })
    toast.success('Settings saved!')
  }}
  onError={(error) => {
    if (error.code === 'SLUG_TAKEN') {
      toast.error('This URL is already taken')
    } else {
      toast.error('Failed to update organization')
    }
  }}
/>

Role Permissions

Only users with the required role (default: admin) will see edit controls. Others will see a read-only view.

CreateOrganization

A form component to create new organizations with name, slug, and optional logo. Handles validation, slug generation, and error states automatically.

Validation
Auto Slug
Basic Usage
import { CreateOrganization } from '@sylphx/platform-sdk/react'

export default function NewOrganizationPage() {
  return (
    <div className="max-w-md mx-auto py-8">
      <h1 className="text-2xl font-bold mb-6">Create Organization</h1>
      <CreateOrganization
        onSuccess={(org) => {
          toast.success(`${org.name} created!`)
          router.push(`/org/${org.slug}/dashboard`)
        }}
      />
    </div>
  )
}

Props

PropertyTypeDescription
onSuccess(org: Organization) => voidCallback fired after successful creation
onError(error: Error) => voidCallback fired on creation error
onCancel() => voidCallback fired when cancel button is clicked
redirectUrlstringURL to redirect after creation
showLogoboolean= trueShow logo upload field
showDescriptionboolean= trueShow description field
showSlugboolean= trueShow URL slug field
autoGenerateSlugboolean= trueAuto-generate slug from name
showCancelButtonboolean= falseShow cancel button
defaultValuesPartial<CreateOrgData>Pre-fill form with default values
titlestring= "Create Organization"Form title
descriptionstringForm description text
submitLabelstring= "Create Organization"Submit button text
cancelLabelstring= "Cancel"Cancel button text
maxNameLengthnumber= 100Maximum organization name length
maxSlugLengthnumber= 50Maximum slug length
themeThemeVariablesCustom theme overrides
classNamestringAdditional CSS classes

Advanced Examples

<CreateOrganization
  showLogo={true}
  showDescription={true}
  showSlug={true}
  showCancelButton={true}
  title="Start Your Team"
  description="Create a workspace for your team to collaborate"
  submitLabel="Get Started"
  cancelLabel="Go Back"
  onSuccess={(org) => {
    // Track creation
    analytics.track('organization_created', {
      orgId: org.id,
      name: org.name,
    })
    // Redirect to setup
    router.push(`/org/${org.slug}/setup`)
  }}
  onCancel={() => {
    router.back()
  }}
  onError={(error) => {
    if (error.code === 'SLUG_TAKEN') {
      toast.error('This URL is already taken, try another name')
    } else if (error.code === 'LIMIT_REACHED') {
      toast.error('You\'ve reached the maximum number of organizations')
    }
  }}
/>

Automatic Slug Generation

When autoGenerateSlug is enabled, the slug is automatically generated from the organization name. Users can still customize it before submission.

OrganizationList

Display all organizations the user belongs to with the ability to switch between them. Perfect for navigation sidebars, dropdowns, or dedicated organization switcher pages.

Switchable
Role Display
Active Indicator
Basic Usage
import { OrganizationList } from '@sylphx/platform-sdk/react'

export default function OrganizationSwitcherPage() {
  return (
    <div className="max-w-md mx-auto py-8">
      <h1 className="text-2xl font-bold mb-6">Your Organizations</h1>
      <OrganizationList
        onSelect={(org) => {
          toast.success(`Switched to ${org.name}`)
          router.push('/dashboard')
        }}
      />
    </div>
  )
}

Props

PropertyTypeDescription
onSelect(org: Organization) => voidCallback fired when an organization is selected
onCreate() => voidCallback fired when create button is clicked
showCreateButtonboolean= trueShow create organization button
showRoleboolean= trueShow user role in each org
showMemberCountboolean= falseShow member count
showLogoboolean= trueShow organization logos
showActiveIndicatorboolean= trueHighlight the active organization
showDescriptionboolean= falseShow organization descriptions
createButtonLabelstring= "Create Organization"Create button text
emptyStateReactNodeCustom empty state component
layout"list" | "grid" | "compact"= "list"Visual layout
maxVisiblenumberMax orgs to show before "show more"
sortBy"name" | "recent" | "role"= "recent"Sort order
filterRoleOrganizationRole[]Only show orgs with these roles
themeThemeVariablesCustom theme overrides
classNamestringAdditional CSS classes

Advanced Examples

<OrganizationList
  layout="compact"
  showRole={false}
  showMemberCount={false}
  showCreateButton={true}
  showActiveIndicator={true}
  maxVisible={5}
  onSelect={(org) => {
    // Just switch, don't navigate
    toast.success(`Now in ${org.name}`)
  }}
  onCreate={() => {
    router.push('/organizations/new')
  }}
  className="w-64"
/>

Theming

All organization components support theming via the theme prop. Customize colors, fonts, and styling to match your brand.

Custom Theme
import {
  OrganizationProfile,
  CreateOrganization,
  OrganizationList,
  defaultTheme,
  type ThemeVariables
} from '@sylphx/platform-sdk/react'

const customTheme: ThemeVariables = {
  ...defaultTheme,
  colorPrimary: '#6366f1',
  colorPrimaryHover: '#4f46e5',
  colorBackground: '#ffffff',
  colorForeground: '#1f2937',
  colorMuted: '#f3f4f6',
  colorMutedForeground: '#6b7280',
  colorBorder: '#e5e7eb',
  fontFamily: 'Inter, sans-serif',
  borderRadius: '0.75rem',
}

// Apply to all organization components
<OrganizationProfile theme={customTheme} />
<CreateOrganization theme={customTheme} />
<OrganizationList theme={customTheme} />
PropertyTypeDescription
colorPrimarystring= #000000Primary brand color
colorPrimaryHoverstring= #1f2937Primary color on hover
colorBackgroundstring= #ffffffComponent background
colorForegroundstring= #1f2937Primary text color
colorMutedstring= #f3f4f6Muted background
colorMutedForegroundstring= #6b7280Secondary text color
colorBorderstring= #e5e7ebBorder color
colorDestructivestring= #ef4444Error/destructive color
colorSuccessstring= #22c55eSuccess color
fontFamilystring= system-uiFont family
borderRadiusstring= 0.5remBorder radius

Best Practices

Wrap with SylphxProvider

Ensure your app is wrapped with SylphxProvider for automatic organization context.

Handle Role Permissions

Components automatically respect role permissions. Non-admins see read-only views.

Provide Error Callbacks

Always provide onError callbacks to show user-friendly error messages.

Consider Empty States

Use the emptyState prop on OrganizationList to guide new users.

Need more customization?

Use the organization hooks for fully custom UI while keeping all the functionality.