Types
Import these types from @solidjs/router unless another entry is shown.
import type { Location, NavigateOptions, RouteDefinition, RouteProps, RouterInstance,} from "@solidjs/router";Router factory
RouterConfig<R>is thecreateRouteroptions object.RouterInstance<R>is the provider component withpaths,routes,config, andmatch.RouterPropscontains the server-onlyurland root render-propchildren.DefinedRoute<S, T, F, C, Sch>is the preserved return type ofdefineRoute.LinkPreloadis a link preload strategy forpreloadLinks.LinksPluginis a link claims plugin forlinks, such aspendingLinks.
See Router factory for signatures.
Route definitions
RouteDefinition<S, T>describes a route config object.RoutePreloadFunc<T, P>is a route preload function.RoutePreloadFuncArgs<P>containsparams,location, andintent.RouteSectionProps<T, P>contains route component props.RouteProps<Path, T>derives route props from a path witness.RouteComponent<Path, T>is a component typed from a path witness.RouteParams<S>derives runtime parameter strings from a path pattern.RouteInfois the augmentable route metadata interface.RouteDescriptionis a compiled route description exposed throughRouteMatch.RouteMatchcombines a compiled route description with matched path and params.OutputMatchis one result fromRouter.match(url).
interface PathMatch<P extends Params = Params> { params: P; path: string;}
interface RouteMatch extends PathMatch { route: RouteDescription;}
interface OutputMatch { path: string; pattern: string; match: string; params: Params; info?: RouteInfo;}Paths and filters
ParamsisRecord<string, string | undefined>.SetParamsaccepts string, number, boolean, null, or undefined values by key.MatchFilteris a string array, regular expression, or predicate.MatchFilters<P>maps route parameter names to match filters.TypedMatchFilter<T>carries a path-builder input type on a runtime filter.TypedPath<P>is the serializable path-node interface.RoutePaths<R>derives the router path proxy from a literal route tuple.PathEnd<Sch, P>is a terminating typed path node.PathParamsOf<N>extracts the runtime parameter record from a path node.
type Params = Record<string, string | undefined>;
type MatchFilter = readonly string[] | RegExp | ((value: string) => boolean);Search parameters
SearchParamscontains raw string, string-array, or undefined values by key.SetSearchParamsaccepts string, number, boolean, arrays of those values, null, or undefined by key.TypedSearchPath<In, Out>carries a route's search input and output types.DefaultSearchTypesusesSetSearchParamsfor input andSearchParamsfor output.StandardSchemaV1<Input, Output>is the validator contract accepted by routesearch.
interface StandardSchemaV1<Input = unknown, Output = Input> { readonly "~standard": { readonly version: 1; readonly vendor: string; readonly validate: ( value: unknown ) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>; readonly types?: { readonly input: Input; readonly output: Output; }; };}Solid Router accepts a Standard Schema promise in the shared type, but useSearchParams(path) rejects an asynchronous validation result at runtime.
Location and navigation
Location<S>is the reactive location read byuseLocation.LocationChange<S>is a history adapter write.NavigateOptions<S>configures resolution, replacement, scrolling, and state.Navigatoris returned byuseNavigate.PathMatch<P>is returned byuseMatch.LinkStateis returned byuseLinkState.BeforeLeaveEventArgsis passed touseBeforeLeave.
See Navigation primitives for signatures.
History integration
RouterHistoryis the history adapter contract.MemoryHistoryAdapterextendsRouterHistorywithgo,back,forward, andlisten.RouterIntegrationis the signal-and-utilities contract used by the router core.RouterUtilscontains optional history rendering, parsing, traversal, leave-guard, params, and query adapters.
See History adapters for the supported built-in adapters.
Data
CachedFunction<T>is returned byquery.LiveFunction<T, U>is returned byliveQuery.LiveQueryStatusis the connection status read byLiveFunction.status.Action<T, U, V>is returned byaction.Submission<T, U>is a settled action record.
See Data APIs for signatures.
Other package entries
@solidjs/router/fs exports:
FileRouteConfigFileRouteEntryFileRouteLazyRefFileRouteEagerRefFileRouteFromFileRoutesFrom
@solidjs/router/server exports:
FlightDataCollectorOptionsCollectFlightDataHookServerFunctionOutcome
See the file-system adapter and server integration pages.