Skip to content

useAppShellConfig

React hook to access only the AppShell configuration (title, icon, basePath, modules, settingsResources). This is a lighter alternative to useAppShell when you only need configuration data.

Signature

typescript
const useAppShellConfig: () => AppShellConfig;

Return Value

PropertyTypeDescription
titlestring | undefinedApp title
iconReact.ReactNode | undefinedApp icon
basePathstring | undefinedBase path for all routes
modulesModule[]Registered modules
settingsResourcesResource[]Resources that appear only in Settings menu

Usage

Display App Info

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

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

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

Access Modules

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

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

Build Custom Navigation

typescript
function CustomNav() {
  const { modules } = useAppShellConfig();

  return (
    <nav>
      {modules.map((module) => (
        <a key={module.path} href={`/${module.path}`}>
          {module.meta?.title}
        </a>
      ))}
    </nav>
  );
}

Settings Resources

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

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

When to Use

Use useAppShellConfig when you only need configuration data:

typescript
// ✅ Good - only need config
const { modules } = useAppShellConfig();

// ❌ Overkill - useAppShell returns more data
const { configurations } = useAppShell();
const modules = configurations.modules;

Comparison with Other Hooks

HookReturnsUse When
useAppShellConfigConfiguration onlyNeed config data
useAppShellDataContext data onlyNeed custom context
useAppShellBoth config + contextNeed both