---
title: "RadioButtonBar"
language: "en"
type: "Symbol"
summary: "RadioButtonBar[x, {val1, val2, ...}] represents a radio button bar with setting x and with labeled radio buttons for values vali. RadioButtonBar[Dynamic[x], {val1, val2, ...}] takes the setting to be the dynamically updated current value of x, with the value of x being reset every time a radio button is pressed. RadioButtonBar[x, {val1 -> lbl1, val2 -> lbl2, ...}] represents a radio button bar in which the radio button giving value vali is given label lbli."
keywords: 
- single selection control
- RadioButtonBar
- RadioButtonBarLabel
- Horizontal
- Vertical
canonical_url: "https://reference.wolfram.com/language/ref/RadioButtonBar.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Control Objects"
    link: "https://reference.wolfram.com/language/guide/ControlObjects.en.md"
  - 
    title: "Creating Form Interfaces & Apps"
    link: "https://reference.wolfram.com/language/guide/CreatingFormsAndApps.en.md"
  - 
    title: "Creating Inspectors"
    link: "https://reference.wolfram.com/language/guide/CreatingInspectors.en.md"
  - 
    title: "User Interface Structuring & Layout"
    link: "https://reference.wolfram.com/language/guide/UserInterfaceStructuringAndLayout.en.md"
related_workflows: 
  - 
    title: "Build a Manipulate"
    link: "https://reference.wolfram.com/language/workflow/BuildAManipulate.en.md"
related_functions: 
  - 
    title: "SetterBar"
    link: "https://reference.wolfram.com/language/ref/SetterBar.en.md"
  - 
    title: "PopupMenu"
    link: "https://reference.wolfram.com/language/ref/PopupMenu.en.md"
  - 
    title: "RadioButton"
    link: "https://reference.wolfram.com/language/ref/RadioButton.en.md"
  - 
    title: "CheckboxBar"
    link: "https://reference.wolfram.com/language/ref/CheckboxBar.en.md"
  - 
    title: "Manipulate"
    link: "https://reference.wolfram.com/language/ref/Manipulate.en.md"
  - 
    title: "Control"
    link: "https://reference.wolfram.com/language/ref/Control.en.md"
related_tutorials: 
  - 
    title: "Introduction to Dynamic"
    link: "https://reference.wolfram.com/language/tutorial/IntroductionToDynamic.en.md"
  - 
    title: "Introduction to Control Objects"
    link: "https://reference.wolfram.com/language/tutorial/IntroductionToControlObjects.en.md"
  - 
    title: "Generalized Input"
    link: "https://reference.wolfram.com/language/tutorial/GeneralizedInput.en.md"
---
# RadioButtonBar

RadioButtonBar[x, {val1, val2, …}] represents a radio button bar with setting x and with labeled radio buttons for values vali.

RadioButtonBar[Dynamic[x], {val1, val2, …}] takes the setting to be the dynamically updated current value of x, with the value of x being reset every time a radio button is pressed.

RadioButtonBar[x, {val1 -> lbl1, val2 -> lbl2, …}] represents a radio button bar in which the radio button giving value vali is given label lbli.

## Details and Options

* The ``vali`` and ``lbli`` can be strings, boxes, graphics, or any other expressions, including dynamic expressions.

* In ``RadioButtonBar[x, list]``, ``Delimiter`` can appear as an element of ``list``, specifying a vertical delimiter in the displayed radio button bar.

* The following options can be given:

|                   |           |                                                         |
| :---------------- | :-------- | :------------------------------------------------------ |
| Appearance        | Automatic | the overall appearance of the radio button bar          |
| Background        | Automatic | background color to use                                 |
| BaselinePosition  | Automatic | alignment relative to surrounding text                  |
| BaseStyle         | {}        | base style specifications for the button bar            |
| Enabled           | Automatic | whether the radio button bar is enabled, or grayed out  |
| ImageMargins      | 0         | margins around the displayed radio button bar           |
| LabelStyle        | {}        | style specifications for the labels                     |

* Possible settings for the ``Appearance`` option include: »

|              |                                           |
| ------------ | ----------------------------------------- |
| "Horizontal" | equally spaced horizontally               |
| "Vertical"   | equally spaced vertically                 |
| "Row"        | laid out like text, allowing linewrapping |

* ``Appearance -> "Vertical" -> {h, w}`` will display the controls in a grid with the specified number of columns and rows, vertically filling each column in turn. ``Appearance -> "Horizontal" -> {h, w}`` horizontally fills the rows instead.

* If one of ``h`` or ``w`` is ``Automatic``, it is taken to be the smallest number so that all the controls will fit in the resulting grid. If both ``h`` and ``w`` are ``Automatic``, they are calculated so the grid has roughly the same number of rows as columns.

* ``Method -> "Active"`` will cause the active area for each item to include the corresponding label.

* The settings for ``BaseStyle`` and ``LabelStyle`` are appended to the default styles typically given by the ``"RadioButtonBar"`` and ``"RadioButtonBarLabel"`` styles in the current stylesheet.

---

## Examples (15)

### Basic Examples (2)

Use five possible settings:

```wl
In[1]:= RadioButtonBar[2, Range[5]]

Out[1]= DynamicModule[«3»]
```

---

Dynamically updated value:

```wl
In[1]:= {RadioButtonBar[Dynamic[x], Range[5]], Dynamic[x]}

Out[1]= {RadioButtonBar[Dynamic[x], {1, 2, 3, 4, 5}], Dynamic[x]}
```

### Scope (2)

Label the values:

```wl
In[1]:= RadioButtonBar[x, {1 -> "Ein", 2 -> "Zwei", 3 -> "Drei"}]

Out[1]= DynamicModule[«3»]
```

---

Separate choices with a ``Delimiter`` :

```wl
In[1]:= RadioButtonBar[{1}, {1, 2, Delimiter, 3}]

Out[1]= DynamicModule[«3»]
```

### Options (10)

#### Appearance (4)

Alter the size:

```wl
In[1]:= Table[RadioButtonBar[x, {1, 2, 3}, Appearance -> a], {a, {Tiny, Small, Medium, Large}}]

Out[1]= {DynamicModule[«3»], DynamicModule[«3»], DynamicModule[«3»], DynamicModule[«3»]}
```

---

Alter the orientation:

```wl
In[1]:= Table[RadioButtonBar[x, {1, 2, 3}, Appearance -> a], {a, {"Horizontal", "Vertical"}}]

Out[1]= {DynamicModule[«3»], DynamicModule[«3»]}
```

---

Using ``"Row"`` will allow a ``RadioButtonBar`` to include a line break:

```wl
In[1]:= RadioButtonBar[x, Range[15], Appearance -> "Row"]

Out[1]= DynamicModule[«3»]

In[2]:= RadioButtonBar[x, Range[15], Appearance -> "Horizontal"]

Out[2]= DynamicModule[«3»]
```

---

Specify a three-column layout, with elements ordered vertically:

```wl
In[1]:= RadioButtonBar[Dynamic[props], CityData["Properties"], Appearance -> "Vertical" -> {Automatic, 3}]

Out[1]=
RadioButtonBar[Dynamic[props], {"AlternateNames", "Coordinates", "Country", "Elevation", 
  "FullName", "Latitude", "LocationLink", "Longitude", "Name", "Population", "Region", 
  "RegionName", "StandardName", "TimeZone"}, Appearance -> "Vertical" -> {Automatic, 3}]
```

#### Background (2)

Change the background for the ``RadioButtonBar`` :

```wl
In[1]:= RadioButtonBar[x, {1, 2, 3}, Background -> Purple]

Out[1]= DynamicModule[«3»]
```

---

Change the background color dynamically:

```wl
In[1]:= RadioButtonBar[Dynamic[x], {Pink -> "Pink", Gray -> "Gray", Yellow -> "Yellow"}, Background -> Dynamic[x]]

Out[1]=
RadioButtonBar[Dynamic[x], {RGBColor[1, 0.5, 0.5] -> "Pink", GrayLevel[0.5] -> "Gray", 
  RGBColor[1, 1, 0] -> "Yellow"}, Background -> Dynamic[x]]
```

#### BaselinePosition (1)

Align the labels with surrounding text:

```wl
In[1]:= Row[Table[RadioButtonBar[1, {1, 2}, BaselinePosition -> b], {b, {Automatic, Bottom, Center, Top}}], " xxx "]

Out[1]=
Row[{RadioButtonBar[1, {1, 2}, BaselinePosition -> Automatic], 
  RadioButtonBar[1, {1, 2}, BaselinePosition -> Bottom], RadioButtonBar[1, {1, 2}, 
   BaselinePosition -> Center], RadioButtonBar[1, {1, 2}, BaselinePosition -> Top]}, " xxx "]
```

#### Enabled (2)

By default ``RadioButtonBar`` is enabled:

```wl
In[1]:= RadioButtonBar[1, {1, 2, 3}, Enabled -> True]

Out[1]= DynamicModule[«3»]
```

---

By setting ``Enabled -> False``, the bar is disabled but visible in its current state:

```wl
In[1]:= RadioButtonBar[1, {1, 2, 3}, Enabled -> False]

Out[1]= DynamicModule[«3»]
```

#### ImageMargins (1)

Add margins to the individual radio buttons:

```wl
In[1]:= Column[Table[RadioButtonBar[1, {1, 2, 3}, ImageMargins -> m], {m, {0, 5, 10}}]]

Out[1]=
DynamicModule[«3»]
DynamicModule[«3»]
DynamicModule[«3»]
```

### Applications (1)

A dynamically updated task list:

```wl
In[1]:= vlabs = {Lighter[Blue, .8] -> "0%", Lighter[Blue, .4] -> "50%", Green -> "100%", Pink -> "Overdue"};

In[2]:=
Grid[{{"Task-1", RadioButtonBar[Dynamic[t1], vlabs]}, 
	{"Task-2", RadioButtonBar[Dynamic[t2], vlabs]}, 
	{"Task-3", RadioButtonBar[Dynamic[t3], vlabs]}}, 
	Background -> {None, {1 -> Dynamic[t1], 2 -> Dynamic[t2], 3 -> Dynamic[t3]}}, Frame -> All]

Out[2]=
|     |     |
| --- | --- |
| "Task-1" | RadioButtonBar[Dynamic[t1], {RGBColor[0.8, 0.8, 1.] -> "0%", RGBColor[0.4, 0.4, 1.] -> "50%",    RGBColor[0, 1, 0] -> "100%", RGBColor[1, 0.5, 0.5] -> "Overdue"}] |
| "Task-2" | RadioButtonBar[Dynamic[t2], { ...   RGBColor[0, 1, 0] -> "100%", RGBColor[1, 0.5, 0.5] -> "Overdue"}] |
| "Task-3" | RadioButtonBar[Dynamic[t3], {RGBColor[0.8, 0.8, 1.] -> "0%", RGBColor[0.4, 0.4, 1.] -> "50%",    RGBColor[0, 1, 0] -> "100%", RGBColor[1, 0.5, 0.5] -> "Overdue"}] |
```

## See Also

* [`SetterBar`](https://reference.wolfram.com/language/ref/SetterBar.en.md)
* [`PopupMenu`](https://reference.wolfram.com/language/ref/PopupMenu.en.md)
* [`RadioButton`](https://reference.wolfram.com/language/ref/RadioButton.en.md)
* [`CheckboxBar`](https://reference.wolfram.com/language/ref/CheckboxBar.en.md)
* [`Manipulate`](https://reference.wolfram.com/language/ref/Manipulate.en.md)
* [`Control`](https://reference.wolfram.com/language/ref/Control.en.md)

## Tech Notes

* [Introduction to Dynamic](https://reference.wolfram.com/language/tutorial/IntroductionToDynamic.en.md)
* [Introduction to Control Objects](https://reference.wolfram.com/language/tutorial/IntroductionToControlObjects.en.md)
* [Generalized Input](https://reference.wolfram.com/language/tutorial/GeneralizedInput.en.md)

## Related Guides

* [Control Objects](https://reference.wolfram.com/language/guide/ControlObjects.en.md)
* [Creating Form Interfaces & Apps](https://reference.wolfram.com/language/guide/CreatingFormsAndApps.en.md)
* [Creating Inspectors](https://reference.wolfram.com/language/guide/CreatingInspectors.en.md)
* [User Interface Structuring & Layout](https://reference.wolfram.com/language/guide/UserInterfaceStructuringAndLayout.en.md)

## Related Workflows

* [Build a Manipulate](https://reference.wolfram.com/language/workflow/BuildAManipulate.en.md)

## History

* [Introduced in 2007 (6.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn60.en.md) \| [Updated in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md)