Skip to main content
Preview of the Domain Table component

Setup Requirements

Auth0 Configuration Required - Ensure your tenant is configured with the My Organization API. View setup guide →

Installation

npm install @auth0/universal-components-react
Running the shadcn command also installs the @auth0/universal-components-core dependency for shared utilities and Auth0 integration.

Quick Start

import { DomainTable } from "@auth0/universal-components-react/spa";

export function DomainsPage() {
  return <DomainTable />;
}
While this example uses a React SPA, the prop configurations (schema, customMessages, styling, etc.) apply equally to Next.js and shadcn setups.
import React from "react";
import { DomainTable } from "@auth0/universal-components-react/spa";
import { Auth0Provider } from "@auth0/auth0-react";
import { Auth0ComponentProvider } from "@auth0/universal-components-react/spa";
import { useNavigate } from "react-router-dom";

function DomainsManagementPage() {
  const navigate = useNavigate();

  return (
    <div className="max-w-6xl mx-auto p-6">
      <DomainTable
        schema={{
          create: {
            domain: {
              regex: /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i,
              errorMessage: "Please enter a valid domain (e.g., example.com)",
            },
          },
        }}
        createAction={{
          onBefore: (domain) => {
            if (!domain.domain.includes(".")) {
              alert("Please enter a valid domain with a TLD");
              return false;
            }
            return true;
          },
          onAfter: (domain) => console.log("Domain created:", domain),
        }}
        verifyAction={{
          onAfter: (domain) => {
            console.log("Domain verified:", domain.domain);
          },
        }}
        deleteAction={{
          onBefore: (domain) => {
            return confirm(`Delete ${domain.domain}?`);
          },
        }}
        onOpenProvider={(provider) => {
          navigate(`/providers/${provider.id}`);
        }}
        onCreateProvider={() => {
          navigate("/providers/create");
        }}
        customMessages={{
          header: {
            title: "Domain Management",
            description: "Add and verify domains for your organization",
            create_button_text: "Add New Domain",
          },
        }}
        styling={{
          variables: {
            common: { "--font-size-label": "12px" },
            light: { "--color-primary": "#0066cc" },
          },
          classes: {
            "DomainTable-header": "shadow-lg rounded-xl",
          },
        }}
      />
    </div>
  );
}

export default function App() {
  return (
    <Auth0Provider
      domain="your-domain.auth0.com"
      clientId="your-client-id"
      authorizationParams={{
        redirect_uri: window.location.origin,
      }}
    >
      <Auth0ComponentProvider>
        <DomainsManagementPage />
      </Auth0ComponentProvider>
    </Auth0Provider>
  );
}

Props

Display Props

Display props control how the component renders without affecting its behavior. Use these to hide sections or enable read-only mode.
PropTypeDescription
readOnlybooleanDisable all domain operations. Default: false
hideHeaderbooleanHide the header section. Default: false

Action Props

Action props handle user interactions and define what happens when users perform domain operations. Use lifecycle hooks (onBefore, onAfter) to integrate with your application’s routing and analytics.
PropTypeDescription
createActionComponentAction<Domain>Create domain action. Details
verifyActionComponentAction<Domain>Verify domain action. Details
deleteActionComponentAction<Domain>Delete domain action. Details
associateToProviderActionComponentAction<Domain, IdentityProvider>Associate domain to provider. Details
deleteFromProviderActionComponentAction<Domain, IdentityProvider>Remove domain from provider. Details
onOpenProvider(provider: IdentityProvider) => voidNavigate to provider from configure modal. Details
onCreateProvider() => voidNavigate to create provider flow. Details

createAction

Type: ComponentAction<Domain> Controls the domain creation flow. Use onAfter to track when new domains are added. Properties:
  • disabled - Disable the “Add Domain” button
  • onBefore(domain) - Called before creation. Return false to cancel. Use for validation.
  • onAfter(domain) - Called after successful creation. Use for analytics or notifications.
Example:
<DomainTable
  createAction={{
    onBefore: (domain) => {
      // Validate domain format
      if (!domain.domain.includes(".")) {
        alert("Please enter a valid domain");
        return false;
      }
      return true;
    },
    onAfter: (domain) => {
      analytics.track("Domain Created", { domain: domain.domain });
    },
  }}
/>

verifyAction

Type: ComponentAction<Domain> Controls the domain verification flow. Domain verification proves ownership via DNS TXT record. Properties:
  • disabled - Disable the verify button
  • onBefore(domain) - Called before verification attempt. Return false to cancel.
  • onAfter(domain) - Called after successful verification.
Example:
<DomainTable
  verifyAction={{
    onBefore: (domain) => {
      return confirm(
        `Verify ${domain.domain}? Make sure your DNS record is configured.`,
      );
    },
    onAfter: (domain) => {
      toast.success(`${domain.domain} verified successfully!`);
    },
  }}
/>

deleteAction

Type: ComponentAction<Domain> Controls domain deletion. Recommended to use onBefore for confirmation since this is destructive. Properties:
  • disabled - Disable the delete button
  • onBefore(domain) - Called before deletion. Return false to cancel.
  • onAfter(domain) - Called after successful deletion.
Example:
<DomainTable
  deleteAction={{
    onBefore: (domain) => {
      return confirm(`Delete ${domain.domain}? This cannot be undone.`);
    },
    onAfter: (domain) => {
      analytics.track("Domain Deleted", { domain: domain.domain });
    },
  }}
/>

associateToProviderAction

Type: ComponentAction<Domain, IdentityProvider> Controls associating a verified domain with an SSO provider. Only verified domains can be associated. Properties:
  • disabled - Disable the associate action
  • onBefore(domain, provider) - Called before association. Return false to cancel.
  • onAfter(domain, provider) - Called after successful association.
Example:
<DomainTable
  associateToProviderAction={{
    onAfter: (domain, provider) => {
      console.log(`Associated ${domain.domain} with ${provider.name}`);
    },
  }}
/>

deleteFromProviderAction

Type: ComponentAction<Domain, IdentityProvider> Controls removing a domain’s association with an SSO provider. Properties:
  • disabled - Disable the disassociate action
  • onBefore(domain, provider) - Called before removal. Return false to cancel.
  • onAfter(domain, provider) - Called after successful removal.

onOpenProvider / onCreateProvider

Type: (provider: IdentityProvider) => void / () => void Navigation handlers for the domain configuration modal. When users configure a domain’s provider associations:
  • onOpenProvider - Called when user clicks on an existing provider to view/edit it
  • onCreateProvider - Called when user clicks to create a new provider
Example:
<DomainTable
  onOpenProvider={(provider) => {
    navigate(`/providers/${provider.id}`);
  }}
  onCreateProvider={() => {
    navigate("/providers/create");
  }}
/>

Customization Props

Customization props let you adapt the component to your brand, locale, and validation requirements without modifying source code.
PropTypeDescription
schemaDomainTableSchemaDomain URL validation rules. Details
customMessagesPartial<DomainTableMainMessages>i18n text overrides. Details
stylingComponentStylingCSS variables and class overrides. Details

schema

Set custom validation rules for domain URL input.
create.domainUrl - Domain URL validation - regex - Custom regex pattern
  • errorMessage - Custom error message
<DomainTable
  schema={{
    create: {
      domain: {
        regex: /^[a-z0-9.-]+\.[a-z]{2,}$/,
        errorMessage: "Enter a valid domain (example.com)",
      },
    },
  }}
/>

customMessages

Customize all text and translations. All fields are optional and use defaults if not provided.
header - Component header
  • title, description, create_button_text
table - Table display
  • empty_message
  • columns.domain, columns.status
  • actions.configure_button_text, actions.verify_button_text, actions.delete_button_text
create.modal - Create domain modal
  • title
  • field.label, field.placeholder, field.error
  • actions.cancel_button_text, actions.create_button_text
verify.modal - Verify domain modal
  • title
  • txt_record_name.label, txt_record_content.label, verification_status.label
  • actions.verify_button_text, actions.done_button_text
delete.modal - Delete confirmation
  • title
  • description.pending, description.verified
  • actions.cancel_button_text, actions.create_button_text
configure.modal - Provider configuration
  • title, description
  • table.empty_message, table.columns.name
  • actions.close_button_text
notifications - API responses
  • domain_create_success, domain_create_error
  • domain_verify_success, domain_delete_success
<DomainTable
  customMessages={{
    header: {
      title: "Manage Domains",
      description: "Configure and verify organization domains",
      create_button_text: "Add Domain",
    },
    table: {
      empty_message: "No domains yet. Add one to begin.",
    },
    notifications: {
      domain_create_success: "Domain added successfully!",
      domain_verify_success: "Domain verified!",
      domain_delete_success: "Domain removed.",
    },
  }}
/>

styling

Customize appearance with CSS variables and class overrides. Supports theme-aware styling.
Variables - CSS custom properties
  • common - Applied to all themes
  • light - Light theme only
  • dark - Dark theme only
Classes - Component class overrides
  • DomainTable-header
  • DomainTable-table
  • DomainTable-createModal
  • DomainTable-configureModal
  • DomainTable-deleteModal
<DomainTable
  styling={{
    variables: {
      common: { "--font-size-title": "1rem" },
      light: { "--color-primary": "#4f46e5" },
    },
    classes: {
      "DomainTable-header": "mb-6",
      "DomainTable-table": "rounded-lg shadow-sm",
    },
  }}
/>

Advanced Customization

The DomainTable component is composed of smaller subcomponents and hooks. You can import them individually to build custom domain workflows if you use shadcn.

Available Subcomponents

For advanced use cases, you can import individual subcomponents to build custom domain management interfaces. This is useful when you need to embed specific modals in different contexts or customize the table layout beyond what props allow.
ComponentDescription
DomainCreateModalModal for creating a domain
DomainVerifyModalModal for verification flow
DomainDeleteModalConfirmation modal for deletion
DomainConfigureProvidersModalManage provider associations
DomainTableActionsColumnAction buttons renderer per domain row

Available Hooks

These hooks provide the underlying logic without any UI. Use them to build completely custom interfaces while leveraging the Auth0 API integration.
HookDescription
useDomainTableData + API layer (fetch, create, verify, delete, associate)
useDomainTableLogicUI interaction state + handlers (modals, notifications)