Skip to main content

Attributes

id
str
The identifier used to retrieve the widget value from the settings.
label
str
The label of the input widget.
values
List[str]
Labels for the radio options.
items
Dict[str, str]
Labels with corresponding values for the radio options.
initial_value
str
The initially selected value.
initial_index
int
Index of the initial value. Can only be used in combination with values.
tooltip
str
The tooltip text shown when hovering over the tooltip icon next to the label.
description
str
The text displayed underneath the input widget.

Usage

Code Example
import chainlit as cl
from chainlit.input_widget import RadioGroup


@cl.on_chat_start
async def start():
    settings = await cl.ChatSettings(
        [
            RadioGroup(
                id="ResponseLength",
                label="Response Length",
                values=["Short", "Medium", "Long"],
                initial_index=1,
            )
        ]
    ).send()
    value = settings["ResponseLength"]