function / @typed/ui/Disclosure

setOpen

Sets disclosure visibility.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Open state
Since
1.0.0

Import

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

Signatures

export declare function setOpen<E, R>(state: RefSubject.RefSubject<State, E, R>, open: boolean): Effect.Effect<State, E, R>;

Why

Explicit state transitions remain composable with Effect and outside renderers.

Ownership and lifetime

The Effect reuses the existing state lifetime and acquires no resource.

Examples

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

const program = Effect.gen(function* () {
  const state = yield* Disclosure.makeState()
  yield* Disclosure.setOpen(state, true)
})

Other public imports

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

Source