[]previous and next page

RouteHeadTag

One head tag a route's head returns.

One head tag a route's head returns. It is the web package's HeadTag with a looser tag: export const head = () => [{ tag: "title", children: "Home" }] is typed by TypeScript with tag: string (a route module has no contextual type to keep the literal), so a plain object literal must be accepted. The head registry checks every tag name when it applies the head: a name it does not manage (script, a typo) throws there with a message naming the tag.

Import#

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

Signature#

ts
interface RouteHeadTag {
  /** `"title" | "meta" | "link" | "style" | "base"`, or any string the registry will then reject. */
  readonly tag: HeadTagName | (string & Record<never, never>);
  readonly props?: Readonly<Record<string, HeadAttributeValue>>;
  readonly children?: string;
  readonly key?: string;
}

Members#

Name Type Description
tag readonly tag: HeadTagName | (string & Record<never, never>) "title" | "meta" | "link" | "style" | "base", or any string the registry will then reject.
props? readonly props?: Readonly<Record<string, HeadAttributeValue>>
children? readonly children?: string
key? readonly key?: string