fun <T> RenderContext.radioGroup(styling: BasicParams.() -> Unit = {}, store: Store<T>, baseClass: StyleClass? = null, id: String? = null, prefix: String = "radioGroupComponent", build: RadioGroupComponent<T>.() -> Unit = {})

This component generates a group of radio buttons.

You can set different kind of properties like the labeltext or different styling aspects like the colors of the background, the label or the selected item. It returns a Flow<String> with the currently selected item, so it can be easily passed to an appropriate handler like the update handler of a store.

For a detailed overview about the possible properties of the component object itself, have a look at RadioGroupComponent

Example usage

val options = listOf("A", "B", "C")
radioGroup {
items { options } // provide a list of items
selected { options[1] } // pre select "B"
} handledBy selectedItemStore.update // combine the Flow<String> with a fitting handler


a flow of the selected item

See also



optional CSS class that should be applied to the element


a lambda expression for setting up the component itself. Details in RadioGroupComponent


the ID of the element


the prefix for the generated CSS class resulting in the form `$prefix-$hash`


a lambda expression for declaring the styling as fritz2's styling DSL