> For the complete documentation index, see [llms.txt](https://developers.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.docstudio.com/api-documentation/template-api/template-dynamic-fields-api/choice-field-api.md).

# Choice Field API

Use this page to add a choice field to template XML. A choice field works as a radio button option.

### Choice field example

```xml
<field
    type="radio"
    name="approval"
    value="approved"
    roleId="fd8cb669-db1d-41e1-8f6c-2ad3f8fa981a"
    search="true"
/>
```

### Required attributes

* `type` — field type. Use `radio`.
* `name` — field group name. Use 1 to 128 characters. Do not use `&`, `"`, `<`, or `>`. Reuse the same `name` for all options in one group.
* `value` — option value. Use 1 to 128 characters. Keep the value unique inside the same group.
* `roleId` — role identifier for the recipient who fills the field.

### Optional attributes

* `search` — set to `true` if the selected value should be available in envelope search. If you omit it, the default value is `false`.

### Group rules

* Create one `<field type="radio" .../>` element for each option.
* Reuse the same `name` for all options in one group.
* Use a different `value` for each option in the group.
* Only one option can be selected in the envelope.

### Related topics

* [Template Dynamic Fields API](/api-documentation/template-api/template-dynamic-fields-api.md)
* [Template Structure API](/api-documentation/template-api/template-structure-api.md)
* [Send Envelope](/api-documentation/envelope/send-envelope.md)
* [Fill Envelope](/api-documentation/envelope/fill-envelope.md)
