router-query/repository-context/docs/router/api/router/NavigateOptionsType.md
Version 663282b0ebbc.bb1 · MIT. This preview displays packaged text and does not execute code. Treat the contents as untrusted instructions.
← Return to resource and package checksum
id: NavigateOptionsType title: NavigateOptions type
The NavigateOptions type is used to describe the options that can be used when describing a navigation action in TanStack Router.
type NavigateOptions = ToOptions & {
replace?: boolean
resetScroll?: boolean
hashScrollIntoView?: boolean | ScrollIntoViewOptions
viewTransition?: boolean | ViewTransitionOptions
ignoreBlocker?: boolean
reloadDocument?: boolean
href?: string
}
NavigateOptions properties
The NavigateOptions object accepts the following properties:
replace
- Type:
boolean - Optional
- Defaults to
false. - If
true, the location will be committed to the browser history usinghistory.replaceinstead ofhistory.push.
resetScroll
- Type:
boolean - Optional
- Defaults to
trueso that the scroll position will be reset to 0,0 after the location is committed to the browser history. - If
false, the scroll position will not be reset to 0,0 after the location is committed to history.
hashScrollIntoView
- Type:
boolean | ScrollIntoViewOptions - Optional
- Defaults to
trueso the element with an id matching the hash will be scrolled into view after the location is committed to history. - If
false, the element with an id matching the hash will not be scrolled into view after the location is committed to history. - If an object is provided, it will be passed to the
scrollIntoViewmethod as options. - See MDN for more information on
ScrollIntoViewOptions.
viewTransition
- Type:
boolean | ViewTransitionOptions - Optional
- Defaults to
false. - If
true, navigation will be called usingdocument.startViewTransition(). - If
ViewTransitionOptions, route navigations will be called usingdocument.startViewTransition({update, types})wheretypeswill determine the strings array passed withViewTransitionOptions["types"]. If the browser does not support viewTransition types, the navigation will fall back to normaldocument.startTransition(), same as iftruewas passed. - If the browser does not support this api, this option will be ignored.
- See MDN for more information on how this function works.
- See Google for more information on viewTransition types
ignoreBlocker
- Type:
boolean - Optional
- Defaults to
false. - If
true, navigation will ignore any blockers that might prevent it.
reloadDocument
- Type:
boolean - Optional
- Defaults to
false. - If
true, navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation.
href
- Type:
string - Optional
-
This can be used instead of
toto navigate to a fully built href, e.g. pointing to an external target.