function / @typed/ui

Menu.makeState

Creates hydrated Menu state. The caller supplies id; open defaults false, activeId null, loop true, and orientation vertical.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Popup state
Since
1.0.0
Member of
Menu

Import

import { Menu } from "@typed/ui";

Access Menu.makeState through the imported Menu export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
    readonly id: string;
    readonly open: boolean;
    readonly activeId: string | null;
    readonly orientation: "vertical";
    readonly loop: boolean;
    readonly rtl: boolean;
    readonly virtualFocus: boolean;
}, Schema.SchemaError, never, never>, never, Scope.Scope>;

Examples

import * as Effect from "effect/Effect";
import * as Menu from "@typed/ui/Menu";

const program = Effect.scoped(
  Effect.gen(function* () {
    const state = yield* Menu.makeState({ id: "file-menu" });
    const collection = yield* Menu.makeCollection();
    return { state: yield* state, collection: yield* collection };
  }),
);

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source