Radio Field

The radio field.


Title Radio
Description Radio Group Field with list of options
Field Type radio
Base Field Type list


Property Type Default Description
enum array List of field value options


Property Type Default Description
dataSource string Datasource for generating list of options. This can be a string or a function. If a string, it is considered S be a URI to a service that produces a object containing key/value pairs or an array of elements of structure {'text': '', 'value': ''}. This can also be a function that is called to produce the same list.
emptySelectFirst boolean If the data is empty, then automatically select the first item in the list.
hideNone boolean Whether to hide the None option from a list (select, radio or otherwise). This will be true if the field is required and false otherwise.
join function For multiple select lists. Defines a f(a) for how selected options should be combined into a single string. A split function should also be defined which reverses this function.
name string Field name.
noneLabel string None The label to use for the 'None' option in a list (select, radio or otherwise).
removeDefaultNone boolean If true, the default 'None' option will not be shown.
sort function Defines an f(a,b) sort function for the array of enumerated values [{text, value}]. This is used to sort enum and optionLabels as well as results that come back from any data sources (for select and radio controls). By default the items are sorted alphabetically. Don't apply any sorting if false.
split function For multiple select lists. Defines a f(a) for how data strings should be split into individual values. A join function should also be defined which reverses this function.
useDataSourceAsEnum boolean true Whether to constrain the field's schema enum property to the values that come back from the data source.
vertical boolean true By default, radio controls are stacked vertically. Set to false if you'd like radio controls to lay out horizontally.

Example 1

Radio button field with data, options and schema parameters. As default, radio group field will be rendered if schema enum properties has 3 or less options.

{% raw %} {% endraw %}

Example 2

Required radio button field with option labels.

{% raw %} {% endraw %}

Example 3

Radio button field with more than 3 options and custom option labels.

{% raw %} {% endraw %}

Example 4

Radio button in display-only mode.

{% raw %} {% endraw %}

Example 5

A radio field that uses the removeDefaultNone option to remove the option for the end user to select None from the list of available options. In addition, the vertical option is set to false`` specified to inform the field to render horizontally. If not specified, vertical``` is assumed to be true.

Note that if the property that the field describes is required for data integrity to be maintained, consider setting the property schema's required setting to true. This produces the same effect and also allows your data to validate appropriately.

{% raw %} {% endraw %}

Example 6

A radio field with disabled values.

{% raw %} {% endraw %}

Example 7

An example of a radio button field mounted on top of an array of strings. Note a radio group only allows for a single selection and so the maximum size of the array will be 1.

{% raw %} {% endraw %}

Example 8

An example of a radio button field that loads its values from a data source.

{% raw %} {% endraw %}

Example 9

Example that sets value after render.

{% raw %} {% endraw %}