ui.input_checkbox_group(id, label, choices, *, selected=None, inline=False, width=None)

Create a group of checkboxes that can be used to toggle multiple choices independently.


id: str

An input id.

label: TagChild

An input label.

choices: ChoicesArg

Either a list of choices or a dictionary mapping choice values to labels. Note that if a dictionary is provided, the keys are used as the (input) values so that the dictionary values can hold HTML labels.

selected: Optional[str | list[str]] = None

The values that should be initially selected, if any.

inline: bool = False

If True, the result is displayed inline.

width: Optional[str] = None

The CSS width, e.g. ‘400px’, or ‘100%’.


Type Description
Tag A UI element.


Server value

A tuple of string(s) with the selected value(s) (if any).

See Also


#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny import App, Inputs, Outputs, Session, render, req, ui

app_ui = ui.page_fluid(
        "Choose color(s):",
            "red": ui.span("Red", style="color: #FF0000;"),
            "green": ui.span("Green", style="color: #00AA00;"),
            "blue": ui.span("Blue", style="color: #0000AA;"),

def server(input: Inputs, output: Outputs, session: Session):
    def val():
        return "You chose " + ", ".join(input.colors())

app = App(app_ui, server)