Skip to content

Latest commit

 

History

History

toggle

Folders and files

README.md

@fictjs/toggle

Toggle primitive for Fict, modeled after @radix-ui/react-toggle. A two-state button that can be on or off.

Part of ui-primitives, a port of Radix Primitives to Fict.

Installation

pnpm add @fictjs/toggle fict

Usage

/** @jsxImportSource fict */
import * as Toggle from '@fictjs/toggle'

export function Example() {
  return <Toggle.Root aria-label="Toggle italic">I</Toggle.Root>
}

Anatomy

  • Toggle.Root (Root) — pressed / defaultPressed, onPressedChange, disabled. Supports asChild.

Exposes data-state ("on" / "off") and data-disabled.

Exports

  • Components: Toggle (Root).
  • Types: ToggleProps.

Documentation

The API mirrors Radix, so the upstream Radix Toggle docs apply. See the ui-primitives overview and the architecture guide for the Fict-specific reactivity model.

License

MIT © Fict contributors.