function / @typed/ui

Disclosure.makeState

Creates hydrated disclosure state.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Open state
Since
1.0.0
Member of
Disclosure

Import

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

Access Disclosure.makeState through the imported Disclosure 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 open: boolean;
}, Schema.SchemaError, never, never>, never, Scope.Scope>;

Why

Applications can own and test open-state transitions independently of UI.

Ownership and lifetime

The calling Effect Scope owns the returned RefSubject.

Examples

import { Effect } from "effect"
import * as Disclosure from "@typed/ui/Disclosure"

const program = Effect.gen(function* () {
  return yield* Disclosure.makeState({ open: true })
})

Other public imports

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

Source