ButtonRadioGroupFieldV1

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

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

A component with buttons that allow the Toloker to choose between the specified values.

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

The size of the button is determined by the length of the text on it.

Parameters Description

ParametersTypeDescription
dataOptional[BaseComponent]

Data with values that will be processed or changed.

optionsOptional[Union[BaseComponent, List[Union[BaseComponent, GroupFieldOption]]]]

Array of information about the buttons.

hintOptional[Any]

Hint text.

labelOptional[Any]

Label above the component.

validationOptional[BaseComponent]

Validation based on condition.

Examples:

How to add buttons for classification task.

classification_buttons = tb.fields.ButtonRadioGroupFieldV1(
tb.data.OutputData(path='class'),
[
tb.fields.GroupFieldOption('Cat', 'cat'),
tb.fields.GroupFieldOption('Dog', 'dog'),
],
validation=tb.conditions.RequiredConditionV1(hint='Choose one of the answer options'),
)
Toloka-Kit
OverviewGetting OAuth tokenQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming