Swap#

Swap toggles the visibility of two elements using a checkbox, with optional rotate or flip animation. Built with Swap.On, Swap.Off, and optional Swap.Indeterminate sub-components.

Import#

TSX
import { Swap } from '@sigx/daisyui';

Basic Text Swap#

Toggle between two text labels.

TSX
Loading preview...

Rotate Effect#

Apply a rotation animation during the swap transition.

TSX
Loading preview...

Flip Effect#

Apply a 3D flip animation during the swap transition.

TSX
Loading preview...

Hamburger Button#

Combine Swap with button classes for a hamburger menu toggle.

TSX
Loading preview...

Active (Class-based)#

Use the active prop to control the swap state without a checkbox interaction.

TSX
Loading preview...

Volume Icons#

Swap between volume on and off icons with rotation.

TSX
Loading preview...

With Indeterminate State#

The Swap.Indeterminate sub-component renders content visible when the checkbox is in an indeterminate state.

TSX
Loading preview...

Props#

Swap#

PropTypeDefaultDescription
rotatebooleanfalseApply rotation animation effect
flipbooleanfalseApply 3D flip animation effect
activebooleanfalseActivate swap display via class (no checkbox needed)
modelSignal<boolean>undefinedTwo-way binding for controlled state
classstringundefinedAdditional CSS classes
onChange(checked: boolean) => voidundefinedCallback when swap state changes

Swap.On#

PropTypeDefaultDescription
classstringundefinedAdditional CSS classes for the on-state element

Swap.Off#

PropTypeDefaultDescription
classstringundefinedAdditional CSS classes for the off-state element

Swap.Indeterminate#

PropTypeDefaultDescription
classstringundefinedAdditional CSS classes for the indeterminate-state element