# RadioButton

> *Note*: You can check the Avalonia docs for the [RadioButton](https://docs.avaloniaui.net/docs/controls/radiobutton) and [RadioButton API](http://reference.avaloniaui.net/api/Avalonia.Controls/RadioButton/) if you need more information.
>
> For Avalonia.FuncUI's DSL properties you can check [RadioButton.fs](https://github.com/fsprojects/Avalonia.FuncUI/blob/master/src/Avalonia.FuncUI/DSL/Buttons/RadioButton.fs)

The RadioButton is a control that allows a user to choose a single value between different options

### Usage

**Set Label**

```fsharp
RadioButton.create [
    RadioButton.content "Opt in to the newsletter"
]
RadioButton.create [
    RadioButton.content "Opt out to the newsletter"
]
```

**Set Is Checked**

```fsharp
RadioButton.create [
    RadioButton.content "Opt in to the newsletter"
    RadioButton.isChecked state.newsLetterOptIn
]
```

**Use A Group of RadioButtons**

```fsharp
RadioButton.create [
    RadioButton.groupName "newsletter"
    RadioButton.content "Opt in to the newsletter"
    RadioButton.isChecked state.newsLetterOptIn
    // remember to use OnChangeOf to give FuncUI hints about when to dispatch the messages
    RadioButton.onChecked ((fun _ -> dispatch OptIn), OnChangeOf(state.newsLetterOptIn))
]
RadioButton.create [
    RadioButton.groupName "newsletter"
    RadioButton.content "Opt out to the newsletter"
    RadioButton.isChecked (not state.newsLetterOptIn)
    // remember to use OnChangeOf to give FuncUI hints about when to dispatch the messages
    RadioButton.onChecked ((fun _ -> dispatch OptOut), OnChangeOf(state.newsLetterOptIn))
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://funcui.avaloniaui.net/controls/radiobutton.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
