Skip to content

@jsvision/ui / withBase

Function: withBase()

withBase<T>(base, extra): T[]

Defined in: ui/src/router/chrome.ts:25

Compose a chrome contribution from a base list plus per-screen extras: [...base, ...extra]. Works for either bar — a status contribution (View[]) or a menu contribution (MenuItem[]).

Pass fresh base items (e.g. from app.statusBase()), not a shared live list: a View has one parent, so composing with the live base bar's own item instances would re-parent them.

Type Parameters

T

T extends View | { kind: string; }

Parameters

base

readonly T[]

The base items (a fresh list — see above).

extra

readonly T[]

The per-screen items to append.

Returns

T[]

A new array of the base items followed by the extras.

Example

ts
// In a route build, keep the app's base status affordances and add a screen-specific one:
status: withBase(app.statusBase(), [statusItem('~E~dit', 'detail.edit')]);