← Back to Components

Switch

Highly interactive slider-toggle switch for toggle inputs.

Interactive Playground

R Code

API Reference

block_switch()

A toggle switch input styled with premium smooth slide animations.

ArgumentTypeDefaultDescription
input_idcharacterrequiredInput id reported back to Shiny as input$.
labelcharacterrequiredVisible label rendered next to the toggle.
valuelogicalFALSEInitial checked state (TRUE/FALSE).
disabledlogicalFALSEDisables the switch while preserving server updates.
stylecharacter | listNULLInline CSS styles applied to the switch wrapper.
classcharacterNULLAdditional class merged onto the runtime switch wrapper.

update_block_switch()

Modifies toggle positions and interactive lockouts instantly.

ArgumentTypeDefaultDescription
sessionShinySessionrequiredStandard active R/Shiny session.
input_idcharacterrequiredTarget switch input ID.
checkedlogicalNULLSet new active toggled checked state.
disabledlogicalNULLToggle lock input interface interactions.