Learn R Programming

bslib (version 0.8.0)

input_dark_mode: Dark mode input control

Description

[Experimental]

Creates a button that toggles between dark and light modes, specifically for toggling between light and dark Bootstrap color modes -- a new feature added in Bootstrap 5.3.

Usage

input_dark_mode(..., id = NULL, mode = NULL)

toggle_dark_mode(mode = NULL, ..., session = get_current_session())

Value

Returns a UI element for a dark mode switch input control. The server value received for the input corresponding to id will be a string value with the current color mode ("light" or "dark").

Arguments

...

Additional attributes to be passed to the input control UI, such as class, style, etc.

In toggle_dark_mode(), the ... are included for future extensibility and are currently ignored.

id

An optional input id, required to reactively read the current color mode.

mode

The initial mode of the dark mode switch. By default or when set to NULL, the user's system settings for preferred color scheme will be used. Otherwise, set to "light" or "dark" to force a particular initial mode.

session

A Shiny session object (the default should almost always be used).

Functions

  • input_dark_mode(): Create a dark mode switch input control

  • toggle_dark_mode(): Programmatically toggle or set the current light or dark color mode.

See Also

Other input controls: input_switch()