function / @typed/ui/Switch

toggle

Toggles the switch between checked and unchecked.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
State transitions
Since
1.0.0

Import

import { toggle } from "@typed/ui/Switch";

Signatures

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

Examples

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

const program = Effect.gen(function* () {
  const state = yield* Switch.makeState({ checked: true })
  yield* Switch.toggle(state)
})

Other public imports

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

Source