Toloka documentation

RadioGroupFieldV1

toloka.client.project.template_builder.fields.RadioGroupFieldV1 | Source code

RadioGroupFieldV1(
    self,
    data: Optional[BaseComponent] = None,
    options: Optional[Union[BaseComponent, List[Union[BaseComponent, GroupFieldOption]]]] = None,
    *,
    disabled: Optional[Union[BaseComponent, bool]] = None,
    hint: Optional[Any] = None,
    label: Optional[Any] = None,
    validation: Optional[BaseComponent] = None,
    version: Optional[str] = '1.0.0'
)

A component for selecting one value out of several options. It is designed as a group of circles arranged vertically.

If you want it to look like normal buttons, use field.button-radio-group.

The minimum number of buttons is one. Any type of data can be returned.

Parameters Description

Parameters Type Description
data Optional[BaseComponent]

Data with values that will be processed or changed.

options Optional[Union[BaseComponent, List[Union[BaseComponent, GroupFieldOption]]]]

List of options to choose from

disabled Optional[Union[BaseComponent, bool]]

This property prevents clicking the button. If the value is true, the button is not active (the user will not be able to click it).

hint Optional[Any]

Hint text.

label Optional[Any]

Label above the component.

validation Optional[BaseComponent]

Validation based on condition.

Examples:

How to add label selector to interface.

radio_group_field = tb.fields.RadioGroupFieldV1(
    tb.data.OutputData(path='result'),
    [
        tb.fields.GroupFieldOption('Cat', 'cat'),
        tb.fields.GroupFieldOption('Dog', 'dog'),
    ],
    validation=tb.conditions.RequiredConditionV1()
)