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.
NavigationLinkpushes component destinations.StandardPageadds a title, toolbar and an automatic back button; custom page components also work.- Use
defaultPathfor an initially pushed destination;onPathChangereports public page IDs without internal_idvalues. Keep identifiers stable. pageand legacyactionsheetpresentations are supported. UseSheetfor 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.