Button

fun TileSchemaBuilderScope.Button(id: String = randomId(), events: EventSchemaBuilderScope.() -> Unit = {}, style: StyleSchemaBuilderScope.() -> Unit = {}, visibility: TileSchema.Visibility = visible(), searchableTerms: List<String>? = null, text: String, icon: IconSchema? = null, buttonType: ButtonTileSchema.Type = filledButton(), shape: ButtonTileSchema.Shape = roundedButton(), loading: Boolean = false, enabled: Boolean = true, iconPosition: ButtonTileSchema.IconPosition = iconAtStart())

Renders a Material 3 button. The visual variant is picked by buttonType (filled, elevated, filled tonal, outlined or text) and its corner style by shape (square or rounded). Shows text together with an optional icon positioned by iconPosition. When loading is true the button shows a spinner instead of its content, and is disabled for real regardless of enabled so a slow action cannot be submitted twice. Dispatches onClick when tapped while interactive.

Parameters

id

Unique identifier of the tile. Defaults to a random id.

events

Events owned by this tile, wired to its triggers (e.g. onClick).

style

Layout/appearance modifiers (size, padding, background, etc).

visibility

Whether the tile is shown, hidden but occupies space, or removed from layout. Defaults to visible.

searchableTerms

Terms used by an ancestor's search/filter to decide whether this tile matches. Defaults to none.

text

Label displayed on the button.

icon

Optional icon rendered alongside the text. Defaults to none.

buttonType

Visual variant of the button — filledButton, elevatedButton, filledTonalButton, outlinedButton or textButton. Defaults to filled.

shape

Corner style of the button — squareButton or roundedButton. Defaults to rounded.

loading

Whether to show a loading spinner instead of the content and force the button disabled. Defaults to false.

enabled

Whether the button is interactive. Ignored (treated as disabled) while loading is true. Defaults to true.

iconPosition

Where the icon is placed relative to the text — iconAtStart or iconAtEnd. Defaults to start.