Learn how to use the Nile Auth Organization component
TenantSelector
component provides an interactive way to manage and switch between tenant organizations within an application. It leverages React Query for fetching tenant data and includes functionality to create new tenants.
Name | Type | Default | Description |
---|---|---|---|
client | QueryClient | null | React Query client instance. |
baseUrl | string | '' | Base API URL for tenant requests. |
className | string | '' | Additional CSS classes. |
useTenants
tenants
: List of available tenants.isLoading
: Whether data is loading.refetch()
: Function to refresh data.useTenantId
tenantId
: The currently selected tenant ID.setTenant(id: string)
: Function to change the active tenant.CreateTenant
Name | Type | Description |
---|---|---|
trigger | React.ReactElement | Element to trigger modal. |
onSuccess | (tenant: Tenant) => void | Callback when tenant is created. |
onError | (error: Error) => void | Callback when creation fails. |
fetchUrl | string | API endpoint for tenant creation. |
className
and buttonText
props,
or using Tailwind CSS theme variables. You can find more details and full examples in the customization doc.
In addition, the hooks documented for each component can be used if you’d like to use Nile Auth with your own components.
If needed, you can peek at the source code of the component and use it as a template to create your own component for maximum customization.