RadioButton

Functions summary

Unit
@Composable
RadioButton(
    checked: Boolean,
    onClick: Action?,
    modifier: GlanceModifier,
    enabled: Boolean,
    text: String,
    style: TextStyle?,
    colors: RadioButtonColors,
    maxLines: Int
)

Adds a radio button to the glance view.

Unit
@Composable
RadioButton(
    checked: Boolean,
    onClick: () -> Unit,
    modifier: GlanceModifier,
    enabled: Boolean,
    text: String,
    style: TextStyle?,
    colors: RadioButtonColors,
    maxLines: Int
)

Adds a radio button to the glance view.

Unit
@ExperimentalGlanceApi
@Composable
RadioButton(
    checked: Boolean,
    onClick: () -> Unit,
    modifier: GlanceModifier,
    enabled: Boolean,
    text: String,
    style: TextStyle?,
    colors: RadioButtonColors,
    maxLines: Int,
    key: String?
)

Adds a radio button to the glance view.

Functions

RadioButton

@Composable
fun RadioButton(
    checked: Boolean,
    onClick: Action?,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    text: String = "",
    style: TextStyle? = null,
    colors: RadioButtonColors = RadioButtonDefaults.colors(),
    maxLines: Int = Int.MAX_VALUE
): Unit

Adds a radio button to the glance view.

When showing a Row or Column that has RadioButton children, use GlanceModifier.selectableGroup to enable the radio group effect (unselecting the previously selected radio button when another is selected).

Parameters
checked: Boolean

whether the radio button is checked

onClick: Action?

the action to be run when the radio button is clicked

modifier: GlanceModifier = GlanceModifier

the modifier to apply to the radio button

enabled: Boolean = true

if false, the radio button will not be clickable

text: String = ""

the text to display to the end of the radio button

style: TextStyle? = null

the style to apply to text

colors: RadioButtonColors = RadioButtonDefaults.colors()

the color tint to apply to the radio button

maxLines: Int = Int.MAX_VALUE

An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated.

RadioButton

@Composable
fun RadioButton(
    checked: Boolean,
    onClick: () -> Unit,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    text: String = "",
    style: TextStyle? = null,
    colors: RadioButtonColors = RadioButtonDefaults.colors(),
    maxLines: Int = Int.MAX_VALUE
): Unit

Adds a radio button to the glance view.

When showing a Row or Column that has RadioButton children, use GlanceModifier.selectableGroup to enable the radio group effect (unselecting the previously selected radio button when another is selected).

Parameters
checked: Boolean

whether the radio button is checked

onClick: () -> Unit

the action to be run when the radio button is clicked

modifier: GlanceModifier = GlanceModifier

the modifier to apply to the radio button

enabled: Boolean = true

if false, the radio button will not be clickable

text: String = ""

the text to display to the end of the radio button

style: TextStyle? = null

the style to apply to text

colors: RadioButtonColors = RadioButtonDefaults.colors()

the color tint to apply to the radio button

maxLines: Int = Int.MAX_VALUE

An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated.

RadioButton

@ExperimentalGlanceApi
@Composable
fun RadioButton(
    checked: Boolean,
    onClick: () -> Unit,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    text: String = "",
    style: TextStyle? = null,
    colors: RadioButtonColors = RadioButtonDefaults.colors(),
    maxLines: Int = Int.MAX_VALUE,
    key: String? = null
): Unit

Adds a radio button to the glance view.

When showing a Row or Column that has RadioButton children, use GlanceModifier.selectableGroup to enable the radio group effect (unselecting the previously selected radio button when another is selected).

Parameters
checked: Boolean

whether the radio button is checked

onClick: () -> Unit

the action to be run when the radio button is clicked

modifier: GlanceModifier = GlanceModifier

the modifier to apply to the radio button

enabled: Boolean = true

if false, the radio button will not be clickable

text: String = ""

the text to display to the end of the radio button

style: TextStyle? = null

the style to apply to text

colors: RadioButtonColors = RadioButtonDefaults.colors()

the color tint to apply to the radio button

maxLines: Int = Int.MAX_VALUE

An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated.

key: String? = null

A stable and unique key that identifies the action for this radio button. This ensures that the correct action is triggered, especially in cases of items that change order. If not provided we use the key that is automatically generated by the Compose runtime, which is unique for every exact code location in the composition tree.