Skip to content
View as Markdown

useAppShellConfig ​

React hook to access only the AppShell configuration (title, icon, favicon, appInfo, and the resolved configurations object with modules, settingsResources, basePath, locale, and timeZone). This is a lighter alternative to useAppShell when you only need configuration data.

Signature ​

typescript
const useAppShellConfig: () => {
  title?: string;
  icon?: React.ReactNode;
  favicon?: string;
  appInfo?: AppInfo;
  configurations: {
    modules: ReturnType<typeof defineModule>[];
    settingsResources: ReturnType<typeof defineResource>[];
    basePath?: string;
    locale: string;
    resolvedLocale?: string;
    timeZone?: string;
    errorBoundary: ErrorBoundaryComponent;
  };
};

Return Value ​

PropertyTypeDescription
titlestring | undefinedApp title
iconReact.ReactNode | undefinedApp icon
faviconstring | undefinedFavicon URL
appInfoAppInfo | undefinedConfiguration for the built-in /__appinfo page
configurationsobjectResolved configuration, see below

configurations ​

PropertyTypeDescription
modulesReturnType<typeof defineModule>[]Registered modules (Module itself is not exported)
settingsResourcesReturnType<typeof defineResource>[]Resources that appear only in Settings menu
basePathstring | undefinedBase path for all routes
localestringLanguage subtag used for built-in UI strings ("en")
resolvedLocalestring | undefinedFull BCP-47 tag used for Intl / date formatting
timeZonestring | undefinedIANA timezone used by date/time components
errorBoundaryErrorBoundaryComponentGlobal error boundary element

Usage ​

Display App Info ​

typescript
import { useAppShellConfig } from "@tailor-platform/app-shell";

function AppInfo() {
  const { title, configurations } = useAppShellConfig();

  return (
    <div>
      <h2>{title}</h2>
      <p>Base: {configurations.basePath}</p>
    </div>
  );
}

Access Modules ​

Module titles are LocalizedString values (a string or a (locale) => string function), so the example lists path instead of rendering meta.title directly.

typescript
function ModuleList() {
  const { configurations } = useAppShellConfig();

  return (
    <ul>
      {configurations.modules.map((module) => (
        <li key={module.path}>{module.path}</li>
      ))}
    </ul>
  );
}

Settings Resources ​

typescript
function SettingsMenu() {
  const { configurations } = useAppShellConfig();

  return (
    <div>
      <h3>Settings</h3>
      {configurations.settingsResources.map((resource) => (
        <button key={resource.path}>{resource.path}</button>
      ))}
    </div>
  );
}

When to Use ​

Use useAppShellConfig when you only need configuration data:

typescript
// ✅ Good - subscribes to configuration only
const { configurations } = useAppShellConfig();

// ❌ Overkill - useAppShell also subscribes to contextData changes
const { configurations } = useAppShell();

Comparison with Other Hooks ​

HookReturnsUse When
useAppShellConfig{ title, icon, favicon, appInfo, configurations }Need config data
useAppShellData{ contextData }Need custom context
useAppShellBoth, merged into one objectNeed both