Skip to main content
AppShell manages routing internally using React Router v7. To ensure proper functionality, you must use AppShell’s re-exported navigation components and hooks instead of installing React Router directly.

Why use AppShell’s exports?

AppShell has its own RouterProvider instance. Using components and hooks from @tailor-platform/app-shell ensures they connect to the correct router context.
Do not install react-router directly or import from it. Always use AppShell’s re-exports to avoid context mismatches.
AppShell re-exports these essential React Router hooks:

Basic usage

Programmatic navigation

Search parameters

Manipulate query strings with useSearchParams:

Command palette

The CommandPalette component provides keyboard-driven quick navigation to any page in your application.

Features

  • Keyboard shortcut: Cmd+K (Mac) or Ctrl+K (Windows/Linux)
  • Fuzzy search: Find pages by title or path
  • Hierarchical display: Shows module > resource breadcrumbs
  • Keyboard navigation: Arrow keys and Enter to navigate
  • Multilingual: Supports English and Japanese locales
  • Smart filtering: Respects access control (hidden routes don’t appear)

Setup

Add the CommandPalette to your AppShell layout:

How it works

The CommandPalette automatically:
  1. Collects all navigable routes from your module definitions
  2. Respects guard functions (routes with hidden() won’t appear)
  3. Updates when navigation items change
  4. Adapts to the current locale
No additional configuration needed—just add the component and it works!

User experience

1

Open command palette

User presses Cmd+K or Ctrl+K anywhere in the app
2

Search for pages

Dialog opens with fuzzy search. Type to filter (e.g., “order detail”)
3

Navigate results

Use arrow keys to navigate through results
4

Navigate to page

Press Enter to navigate to the selected page

Type-safe navigation

When using file-based routing with the Vite plugin, you can enable automatic generation of type-safe route helpers.

Enable typed routes

Configure in your Vite config:

Generated file

The plugin generates src/routes.generated.ts:

Usage with TypeScript

Benefits

Compile-time safety

TypeScript catches invalid routes and missing parameters before runtime

Auto-completion

IDE autocomplete for all routes and their required parameters

Refactoring support

Rename routes and parameters with confidence

Opt-in design

Use only when needed—manual path strings still work

Opt-in design

Typed routes are completely optional. Without generateTypedRoutes, you can continue building paths dynamically:

HMR support

The generated file automatically updates when:
  • A new page.tsx is added
  • A page.tsx is deleted
  • The dev server starts
The file regenerates automatically during development, so your types always stay in sync with your routes.

File-based routing

Define routes using directory structure

Modules and resources

Understand AppShell’s routing architecture