import { KbqAppSwitcherModule } from '@koobiq/components/app-switcher';

KbqAppSwitcherComponent

componentCopy link to KbqAppSwitcherComponent

Popup rendered by KbqAppSwitcherTrigger. The trigger attaches it to a CDK overlay itself (see getOverlayHandleComponentType) and assigns trigger on the created instance, so consumers never place <kbq-app-switcher> in a template - [kbqAppSwitcher] on the trigger element is the whole public surface.

@Component({ selector: 'kbq-app-switcher' })
class KbqAppSwitcherComponent extends KbqPopUp {
    readonly localeConfiguration: Signal<KbqAppSwitcherLocaleConfiguration>;
    readonly destroyRef: DestroyRef;
    readonly hovered: Signal<boolean>;
    header: string | TemplateRef<unknown>;
    content: string | TemplateRef<unknown>;
    context: { $implicit: unknown } | null;
    classMap: {};
    arrow: boolean;
    arrowCentered: boolean;
    defaultPaddings: boolean;
    offset: number | null;
    visibility: PopUpVisibility;
    visibleChange: EventEmitter<boolean>;
    isTemplateRef(value: any): boolean;
    show(delay: number): void;
    hide(delay: number): void;
    isVisible(): boolean;
    afterHidden(): Observable<void>;
    detectChanges(): void;
}
localeConfigurationCopy link to localeConfigurationSignal<KbqAppSwitcherLocaleConfiguration>

Strings currently rendered by the popup.

hoveredCopy link to hoveredSignal<boolean>

Whether the pointer is over the pop-up.

classMapCopy link to classMap{}

CSS classes of the pop-up element: the placement, the custom class and the modifiers of the subclass.

arrowCenteredCopy link to arrowCenteredboolean

Whether the arrow points at the origin center while the panel keeps its placement. Defaults to false.

visibilityCopy link to visibilityPopUpVisibility

Stage of the pop-up's life: not shown yet, visible, or hidden.

hide()Copy link to hide()void

Hides the popup after a specified delay.

The hide timeout triggers the hiding of the popup by updating visibility and emitting relevant events.

Parameters
delaynumber

The delay in milliseconds before hiding the popup.

afterHidden()Copy link to afterHidden()Observable<void>

Returns an observable that notifies when the tooltip has been hidden from view.

KbqAppSwitcherTrigger

directiveCopy link to KbqAppSwitcherTrigger
@Directive({ selector: '[kbqAppSwitcher]', exportAs: 'kbqAppSwitcher' })
class KbqAppSwitcherTrigger extends KbqPopUpTrigger<KbqAppSwitcherComponent> {
    readonly selectedApp = model<KbqAppSwitcherApp | undefined>();
    backdropClass = input<string | undefined>();
    offset = input<number | null | undefined>();
    sites = input<KbqAppSwitcherSite[] | undefined>();
    groupBy = input<KbqAppSwitcherGroupBy | undefined>();
    readonly selectedSite = model<KbqAppSwitcherSite | undefined>();
    disabled = input<boolean | undefined>();
    get withSearch(): boolean;
    placement: KbqPopUpPlacementValues;
    readonly placementChange: EventEmitter<KbqPopUpPlacementValues>;
    readonly visibleChange: EventEmitter<boolean>;
    set originalSites(value: KbqAppSwitcherSite[]);
    isOpen: boolean;
    get isAttached(): boolean;
    get openedChange(): Observable<boolean>;
    arrowCentered: boolean;
    updateOrigin(origin: KbqOverlayOrigin | null): void;
}
selectedAppmodelCopy link to selectedAppKbqAppSwitcherApp | undefined

Selected application

backdropClassinputCopy link to backdropClassstring | undefined

Class that will be used in the background

offsetinputCopy link to offsetnumber | null | undefined

Offset of popUp

sitesinputCopy link to sitesKbqAppSwitcherSite[] | undefined

Array of sites, with the applications of each site grouped for rendering.

groupByinputCopy link to groupByKbqAppSwitcherGroupBy | undefined

Function to group the apps by type. The first argument is an app object with type. The second is a groups object and third is an array for untyped apps

selectedSitemodelCopy link to selectedSiteKbqAppSwitcherSite | undefined

Selected site

disabledinputCopy link to disabledboolean | undefined

Whether the trigger is disabled.

withSearchCopy link to withSearchboolean

Whether search is used or not

placementChangeCopy link to placementChangeEventEmitter<KbqPopUpPlacementValues>

Emits a change event whenever the placement state changes.

visibleChangeCopy link to visibleChangeEventEmitter<boolean>

Emits a change event whenever the visible state changes.

isOpenCopy link to isOpenboolean

Whether the pop-up overlay is currently open.

isAttachedCopy link to isAttachedboolean

Whether the pop-up overlay is currently attached.

Unlike isOpen, which follows the visibility of the pop-up component and therefore lags a task behind show()/hide(), this flips synchronously — it is the window during which the overlay (and its backdrop) is present in the DOM. Part of the KbqSiblingPopup contract.

openedChangeCopy link to openedChangeObservable<boolean>

Emits true when the pop-up opens and false when it closes. Part of the KbqSiblingPopup contract.

arrowCenteredCopy link to arrowCenteredboolean

Whether the arrow points at the origin center while the panel keeps its placement. Defaults to false.

updateOrigin()Copy link to updateOrigin()void

Positions the pop-up against origin — an element, or a rectangle in viewport coordinates such as the one kbqCreateCaretOrigin keeps on the caret — instead of the host element; null restores the host element. An open pop-up moves to the new origin at once.

This moves the position origin only. setExternalNativeElement moves the host itself, and with it the trigger's event listeners, its focus target and the scroll containers the pop-up follows.

KbqAppSwitcherIconSanitizer

serviceCopy link to KbqAppSwitcherIconSanitizer

Turns the caller-supplied inline SVG of an app-switcher icon into markup that is safe to hand to [innerHtml].

Angular's own HTML sanitizer cannot be used here: its allow-list contains no SVG elements at all, so it would strip every icon. Instead the markup is parsed inert (inside a <template>, where no request is issued and no script runs), filtered against a strict SVG allow-list, and only then marked as trusted.

@Injectable({ providedIn: 'root' })
class KbqAppSwitcherIconSanitizer {
    sanitize(icon: string | null | undefined): SafeHtml | null;
}
sanitize()Copy link to sanitize()SafeHtml | null

Sanitizes inline SVG markup and wraps it as SafeHtml. Returns null for empty input, so callers can use the result directly as the @if condition of the icon element.

kbqAppSwitcherProvider

functionCopy link to kbqAppSwitcherProvider

Providers used by the app-switcher. KbqAppSwitcherModule applies them for NgModule consumers; standalone consumers that import KbqAppSwitcherTrigger directly may add them to their application (or route) providers.

Providing them is optional: the only entry is the scroll strategy, and the directive falls back to the default repositioning strategy when the token is absent. The app-switcher renders no focus trap, so - unlike KbqPopoverModule and KbqNotificationCenterModule, whose templates bind [cdkTrapFocus] - it must not swap FOCUS_TRAP_INERT_STRATEGY/FocusTrapFactory: those are injector-wide and would disable the CDK inert strategy for every other focus trap in the same scope.

function kbqAppSwitcherProvider(): Provider[];

makeGroupsForApps

functionCopy link to makeGroupsForApps

Runs groupBy over apps and returns the rendered order: synthetic groups big enough to be collapsible first, then every remaining application as a plain row.

A group is kept only when it holds strictly more than minAppsForGrouping applications; smaller groups are flattened back into plain rows.

function makeGroupsForApps(
    apps: KbqAppSwitcherApp[],
    minAppsForGrouping: number,
    groupBy?: KbqAppSwitcherGroupBy
): KbqAppSwitcherApp[];

KbqAppSwitcherApp

interfaceCopy link to KbqAppSwitcherApp
interface KbqAppSwitcherApp {
    name: string;
    id: string | number;
    type?: string | number;
    icon?: string;
    iconSrc?: string;
    caption?: string;
    aliases?: KbqAppSwitcherApp[];
    link?: string;
}
iconoptionalCopy link to iconstring

Inline SVG markup for the application icon. Use this for SVG icons that should be rendered directly in the DOM.

The markup is sanitized against a strict SVG allow-list before it is rendered (see KbqAppSwitcherIconSanitizer): scripts, event handlers, foreignObject, style and external references are removed. Prefer iconSrc when the icon comes from a URL.

iconSrcoptionalCopy link to iconSrcstring

Path to the icon file (URL or relative path).

KbqAppSwitcherGroupBy

typeCopy link to KbqAppSwitcherGroupBy

Reducer that assigns an application to a group. Called once per application; implementations either push the app into untyped (rendered as a plain row) or add it to a synthetic group in groups.

type KbqAppSwitcherGroupBy = (
    app: KbqAppSwitcherApp,
    groups: Record<string, KbqAppSwitcherApp>,
    untyped: KbqAppSwitcherApp[]
) => void;

KbqAppSwitcherSite

interfaceCopy link to KbqAppSwitcherSite
interface KbqAppSwitcherSite {
    name: string;
    id: string | number;
    status?: string;
    icon?: string;
    iconSrc?: string;
    apps: KbqAppSwitcherApp[];
}
iconoptionalCopy link to iconstring

Inline SVG markup for the site icon. Use this for SVG icons that should be rendered directly in the DOM. Sanitized the same way as KbqAppSwitcherApp.icon.

iconSrcoptionalCopy link to iconSrcstring

Path to the icon file (URL or relative path).

KBQ_APP_SWITCHER_CONFIGURATION

constDeprecatedCopy link to KBQ_APP_SWITCHER_CONFIGURATION

Use KBQ_APP_SWITCHER_LOCALE_CONFIGURATION. Will be removed in 22.0.0.

const KBQ_APP_SWITCHER_CONFIGURATION: InjectionToken<KbqAppSwitcherLocaleConfiguration>;

KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION

constDeprecatedCopy link to KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION

Use KBQ_APP_SWITCHER_DEFAULT_LOCALE_CONFIGURATION. Will be removed in 22.0.0.

const KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION: KbqAppSwitcherLocaleConfiguration;

KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING

constCopy link to KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING
const KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING: number;

KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH

constCopy link to KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH
const KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH: number;

kbqAppSwitcherLocaleConfigurationProvider

constCopy link to kbqAppSwitcherLocaleConfigurationProvider

Utility provider for KBQ_APP_SWITCHER_LOCALE_CONFIGURATION. Only the strings you pass are overridden; the rest keep following the active locale.

const kbqAppSwitcherLocaleConfigurationProvider: (
    configuration: KbqDeepPartial<KbqAppSwitcherLocaleConfiguration>
) => Provider;
Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.