Components

NavigationStack

Manage an in-memory stack of React pages with forward and back navigation.

Example

Requires React 18.2+ or 19 and shared styles. See setup.

Default

Loading preview…

Code
'use client';
import { NavigationLink, StandardPage, Text } from '@swiftuijs/ui';
import { NavigationStack } from '@swiftuijs/ui';
export default function Example() {
    function Details() {
        return <StandardPage id="details" navigationTitle="Details"><Text>Detail content</Text></StandardPage>;
    }
    return <NavigationStack style={{ height: 320 }}>
      <StandardPage id="home" navigationTitle="Home">
        <NavigationLink destination={Details}>Open details</NavigationLink>
      </StandardPage>
    </NavigationStack>;
}

Usage and limitations

  • Give the stack a bounded height so pages and scroll areas have available space.
  • NavigationLink pushes component destinations. StandardPage adds a title, toolbar and an automatic back button; custom page components also work.
  • Use defaultPath for an initially pushed destination; onPathChange reports public page IDs without internal _id values. Keep identifiers stable.
  • page and legacy actionsheet presentations are supported. Use Sheet for a modal with focus trapping and background isolation.
  • Browser history, deep links and URL routing require application integration. Observe path changes to synchronize external navigation state.

More examples

Navigation Stack Between
Preloaded Path

API reference

This component currently relies on inherited element props.