Button

Functions summary

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

Adds a button view to the glance view.

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

Adds a button view to the glance view.

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

Adds a button view to the glance view.

Functions

Button

@Composable
fun Button(
    text: String,
    onClick: Action,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    style: TextStyle? = null,
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    maxLines: Int = Int.MAX_VALUE
): Unit

Adds a button view to the glance view.

Parameters
text: String

The text that this button will show.

onClick: Action

The action to be performed when this button is clicked.

modifier: GlanceModifier = GlanceModifier

The modifier to be applied to this button.

enabled: Boolean = true

If false, the button will not be clickable.

style: TextStyle? = null

The style to be applied to the text in this button.

colors: ButtonColors = ButtonDefaults.buttonColors()

The colors to use for the background and content of the 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.

Button

@Composable
fun Button(
    text: String,
    onClick: () -> Unit,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    style: TextStyle? = null,
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    maxLines: Int = Int.MAX_VALUE
): Unit

Adds a button view to the glance view.

Parameters
text: String

The text that this button will show.

onClick: () -> Unit

The action to be performed when this button is clicked.

modifier: GlanceModifier = GlanceModifier

The modifier to be applied to this button.

enabled: Boolean = true

If false, the button will not be clickable.

style: TextStyle? = null

The style to be applied to the text in this button.

colors: ButtonColors = ButtonDefaults.buttonColors()

The colors to use for the background and content of the 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.

Button

@ExperimentalGlanceApi
@Composable
fun Button(
    text: String,
    onClick: () -> Unit,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    style: TextStyle? = null,
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    maxLines: Int = Int.MAX_VALUE,
    key: String? = null
): Unit

Adds a button view to the glance view.

Parameters
text: String

The text that this button will show.

onClick: () -> Unit

The action to be performed when this button is clicked.

modifier: GlanceModifier = GlanceModifier

The modifier to be applied to this button.

enabled: Boolean = true

If false, the button will not be clickable.

style: TextStyle? = null

The style to be applied to the text in this button.

colors: ButtonColors = ButtonDefaults.buttonColors()

The colors to use for the background and content of the 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 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.