---
url: >-
  https://lit-ui-router.dev/api/lit-ui-router-effect/interfaces/RouterRefControllerOptions.md
---
[lit-ui-router-effect](../index.md) / RouterRefControllerOptions

# Interface: RouterRefControllerOptions\<T>

Defined in: [lit-ui-router-effect/src/router-ref-controller.ts:11](https://github.com/simshanith/lit-ui-router/blob/94983cdc3394e721dde003188282f6209606ba22/packages/lit-ui-router-effect/src/router-ref-controller.ts#L11)

Options for [RouterRefController](../classes/RouterRefController.md).

## Extends

* [`RefControllerOptions`](RefControllerOptions.md)<`T`>

## Type Parameters

| Type Parameter |
| ------ |
|  `T` |

## Properties

| Property | Type | Description | Inherited from | Defined in |
| ------ | ------ | ------ | ------ | ------ |
|  `equals?` | (`a`, `b`) => `boolean` | Comparer deciding whether the selected value changed. Defaults to `Object.is`; pass `Equal.equals` for structural comparison (plain objects on effect 4, `Data` values on either major). | [`RefControllerOptions`](RefControllerOptions.md).[`equals`](RefControllerOptions.md#equals) | [lit-ui-router-effect/src/ref-controller.ts:61](https://github.com/simshanith/lit-ui-router/blob/94983cdc3394e721dde003188282f6209606ba22/packages/lit-ui-router-effect/src/ref-controller.ts#L61) |
|  `initialValue?` | `T` | Value exposed on `.value` before the first read of a ref that is only resolved on `hostConnected` (see [RefSource](../type-aliases/RefSource.md)) — that is, before the host connects, and on any host that renders while disconnected (SSR). Refs given directly are read at construction instead, so they never need it. | [`RefControllerOptions`](RefControllerOptions.md).[`initialValue`](RefControllerOptions.md#initialvalue) | [lit-ui-router-effect/src/ref-controller.ts:54](https://github.com/simshanith/lit-ui-router/blob/94983cdc3394e721dde003188282f6209606ba22/packages/lit-ui-router-effect/src/ref-controller.ts#L54) |
|  `onChange?` | (`value`) => `void` | Invoked (before `host.requestUpdate()`) whenever the selected value changes — and once on every host (re)connect. Use for effects such as resetting component state from route params. | [`RefControllerOptions`](RefControllerOptions.md).[`onChange`](RefControllerOptions.md#onchange) | [lit-ui-router-effect/src/ref-controller.ts:45](https://github.com/simshanith/lit-ui-router/blob/94983cdc3394e721dde003188282f6209606ba22/packages/lit-ui-router-effect/src/ref-controller.ts#L45) |
|  `router?` | | [`UIRouter`](https://ui-router.github.io/core/docs/latest/classes/_router_.uirouter.html) | (() => | [`UIRouter`](https://ui-router.github.io/core/docs/latest/classes/_router_.uirouter.html) | `undefined`) | Explicit router instance, or a thunk returning one. When omitted (or the thunk returns `undefined`), the controller takes the router an enclosing [`withRouterSync`](https://lit-ui-router.dev/api/reference/core/withRouterSync) scoped at construction (a server render), and otherwise requests the router from the nearest provider on `hostConnected` over `context-request` (via [requestRouter](https://lit-ui-router.dev/api/reference/core/requestRouter) with `subscribe: true`), and follows the router that provider hands it later, such as the app's router replacing a served page's placeholder. An explicit or scoped router is read at construction, so `.value` is live before the host connects. A thunk is resolved at construction and again on each `hostConnected`; a router it returns replaces the one followed, as [RouterRefController.setRouter](../classes/RouterRefController.md#setrouter) does. An explicit router is never replaced by one a provider hands over. A `lit-ui-router` that does not hand subscribers the router replacing its placeholder leaves a served page's host on the placeholder; hand such a host its router. | - | [lit-ui-router-effect/src/router-ref-controller.ts:30](https://github.com/simshanith/lit-ui-router/blob/94983cdc3394e721dde003188282f6209606ba22/packages/lit-ui-router-effect/src/router-ref-controller.ts#L30) |
|  `runtime?` | [`RefRuntime`](RefRuntime.md) | The runtime the subscription fiber is forked on, and refs are read with. Defaults to Effect's default runtime; pass the app's `ManagedRuntime` to keep the fibers on one. The selector gets no services from it. | [`RefControllerOptions`](RefControllerOptions.md).[`runtime`](RefControllerOptions.md#runtime) | [lit-ui-router-effect/src/ref-controller.ts:68](https://github.com/simshanith/lit-ui-router/blob/94983cdc3394e721dde003188282f6209606ba22/packages/lit-ui-router-effect/src/ref-controller.ts#L68) |
