[]previous and next page

NavigateBaseOptions

The options of a navigation that do not depend on its target: everything except params.

The options of a navigation that do not depend on its target: everything except params.

Import#

ts
import type { NavigateBaseOptions } from "@shadow-js/router";

Signature#

ts
interface NavigateBaseOptions {
  /** Replace the current entry instead of pushing. */
  readonly replace?: boolean;
  /**
   * How a relative `to` (one that does not start with `/`) is resolved. `"path"`: against the
   * current pathname, as a directory (`edit` from `/posts/7` is `/posts/7/edit`). `"route"`: against
   * the pattern of the deepest route matched there, whose params are kept unless `params` overrides
   * them. Absolute targets are not changed. Default: the target is resolved as a URL against the
   * current location. Needs the `relative` feature (`relativeLinks()` from `@shadow-js/router/relative`).
   */
  readonly relative?: "path" | "route";
  /** Stored in `history.state` for the new entry. */
  readonly state?: unknown;
  /** Search to merge onto the target's own query, serialized with the codec. `undefined` removes a key. */
  readonly search?: SearchPatch;
  /** Hash to set, with or without `#`. */
  readonly hash?: string;
  /**
   * `false` commits this navigation without a view transition, even when the `transitions` feature is on. Default:
   * the navigation transitions. Ignored without that feature.
   */
  readonly viewTransition?: boolean | undefined;
}

Members#

Name Type Description
replace? readonly replace?: boolean Replace the current entry instead of pushing.
relative? readonly relative?: "path" | "route" How a relative to (one that does not start with /) is resolved. "path": against the current pathname, as a directory (edit from /posts/7 is /posts/7/edit). "route": against the pattern of the deepest route matched there, whose params are kept unless params overrides them. Absolute targets are not changed. Default: the target is resolved as a URL against the current location. Needs the relative feature (relativeLinks() from @shadow-js/router/relative).
state? readonly state?: unknown Stored in history.state for the new entry.
search? readonly search?: SearchPatch Search to merge onto the target's own query, serialized with the codec. undefined removes a key.
hash? readonly hash?: string Hash to set, with or without #.
viewTransition? readonly viewTransition?: boolean | undefined false commits this navigation without a view transition, even when the transitions feature is on. Default: the navigation transitions. Ignored without that feature.