Download

Radio buttons

If you want to allow an user to select a value from the predefined list you can use radio buttons or the dropdown list.

Radio buttons have a special parameter to define available option values and their labels:

{
    "name": "layoutFrontpage",
    "label": "Frontpage layout",
    "group": "Layout",
    "value": "cols-3",
    "type": "radio",
    "options": [
        {
            "label": "1 column",
            "value": "cols-1",
            "disabled": false
        },
        {
            "label": "2 columns",
            "value": "cols-2",
            "disabled": false
        },
        {
            "label": "3 columns",
            "value": "cols-3",
            "disabled": false
        }
    ]
}

Above code will generate a radio buttons list with three options:

Radio buttons

You can disable some options using the disabled field for each option.

What are you waiting for?

Start building your site today.

  1. 1 Download Publii
  2. 2 Write your content
  3. 3 Publish your site
Create website