function / @typed/ui/Tabs

makeState

Creates hydrated Tabs state. The caller supplies value; activeId defaults to value, activation is automatic, orientation horizontal, and loop true.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Selection and focus
Since
1.0.0

Import

import { makeState } from "@typed/ui/Tabs";

Signatures

export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
    readonly selectedId: string;
    readonly activeId: string;
    readonly activationMode: "manual" | "automatic";
    readonly orientation: "horizontal" | "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 Tabs from "@typed/ui/Tabs";

const program = Effect.scoped(
  Effect.gen(function* () {
    const state = yield* Tabs.makeState({ selectedId: "overview" });
    const collection = yield* Tabs.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