Skip to content

Radio

One value of a few options, all visible as radio buttons. Same values and rules as the Select.

use Anvil\Schema\Fields\Radio;
Radio::make('gender')->options(['f' => 'Female', 'm' => 'Male', 'd' => 'Diverse'])->inline(),
Radio::make('delivery')->options(['pickup' => 'Pick-up', 'mail' => 'By mail'])->required()->default('pickup'),
Option Effect Default
options([value => label]) the choices
inline() buttons side by side instead of one per line one per line

Plus the options of every field. Option values must not contain commas.

As for the Select: the value, in_list[…] of the option values, the label read-only and a string with enum in the API. Without required() and without default no button is selected and the value is null.