Examples
Animation="SwapAnimation.Rotate" spins between the icons; @bind-Active keeps your field in sync.
Light mode
website/Examples/Actions/SwapRotateExample.razor
Source
SwapAnimation.Flip turns the content over like a card.
Sync paused
website/Examples/Actions/SwapFlipExample.razor
Source
On and Off take any markup; without an animation the switch is instant.
website/Examples/Actions/SwapTextExample.razor
Source
API
<Swap>
DaisyBlazorParameters
- Active bool= false
Whether the swap is in the active (on) state.
- Animation SwapAnimation= SwapAnimation.None
Animation applied to the swap transition.
- AriaLabel string= null
Accessible name of the toggle, read by screen readers (the On/Off content is usually an icon).
- Class string= null
Extra CSS classes merged onto the swap label.
- Style string= null
Inline CSS styles applied to the swap label.
Events
- ActiveChanged EventCallback<
bool> Raised when the active state changes.
Content
- Off RenderFragment
Content shown when the swap is inactive (unchecked).
- On RenderFragment
Content shown when the swap is active (checked).