Develop

Button

Updated: Aug 29, 2026

Overview

Buttons initiate actions based on user interaction. The Meta VR UI Set SDK provides three push buttons, two selectable buttons, and five semantic styles that set their colors. Every button reads its colors, shape, typography, and interaction feedback from UiSetTheme, and meets the hit target sizes in the Android design requirements.

Common features

  • Interaction feedback: Press, hover, and focus indication comes from UiSetTheme.indications, split around the button clipping boundary.
  • Theming: Colors, shape, height, padding, and icon geometry derive from UiSetTheme.
  • Accessibility: Interaction targets stay at least 48 dp in both Standard and Compact dimensions. IconButton takes a contentDescription because it has no visible label.
  • enabled parameter: Controls interactivity and applies the disabled colors of the active style.
  • Focused overrides: style and dimensions are immutable values, so copy() changes one property without replacing the theme.

Button styles

ButtonStyle carries the container, content, and border colors for both the enabled and disabled states. Pass one to any push button through style.

Primary

  • Value: ButtonStyle.Primary
  • Usage: The recommended action on a surface, such as Confirm, Save, or Continue. High emphasis.
  • Appearance: Accent container with accent content color.

Secondary

  • Value: ButtonStyle.Secondary
  • Usage: Supporting actions beside a primary action, such as Cancel. Medium emphasis.
  • Appearance: Muted accent container.

Bordered

  • Value: ButtonStyle.Bordered
  • Usage: Low-emphasis actions that still need a visible boundary.
  • Appearance: Transparent container with a semantic outline.

Borderless

  • Value: ButtonStyle.Borderless
  • Usage: The lowest-emphasis actions, such as toolbar or inline actions.
  • Appearance: Transparent container with no outline.

Destructive

  • Value: ButtonStyle.Destructive
  • Usage: Actions that delete data or cannot be undone, such as Delete or End call. The color warns the user.
  • Appearance: Negative container color.
import metavrx.uiset.compose.button.ButtonStyle
import metavrx.uiset.compose.button.LabelButton

LabelButton(label = "Save", onClick = { /* ... */ }, style = ButtonStyle.Primary)
LabelButton(label = "Cancel", onClick = { /* ... */ }, style = ButtonStyle.Secondary)
LabelButton(label = "Delete", onClick = { /* ... */ }, style = ButtonStyle.Destructive)
LabelButton(label = "Save", onClick = { /* ... */ }, enabled = false)

Button types

Label button

  • Composable: LabelButton
  • Usage: The standard text action, with an optional leading icon.
  • Layout: A single row. Set expanded to fill the available width.
import metavrx.uiset.compose.Icon
import metavrx.uiset.compose.button.LabelButton
import metavrx.uiset.compose.theme.icons.Icons

LabelButton(
    label = "Message",
    onClick = { /* ... */ },
    leadingIcon = { Icon(Icons.Regular.Chat, contentDescription = null) },
)

Icon button

  • Composable: IconButton
  • Usage: Compact icon-only actions, such as toolbar controls.
  • Layout: A circle sized by dimensions.
import metavrx.uiset.compose.button.IconButton

IconButton(
    icon = { Icon(Icons.Regular.Settings, contentDescription = null) },
    onClick = { /* ... */ },
    contentDescription = "Settings",
    style = ButtonStyle.Secondary,
)

Custom content button

  • Composable: Button
  • Usage: Arrangements that the label and icon buttons do not cover, while keeping UI Set interaction behavior and theming.
  • Layout: A BoxScope that holds arbitrary content, positioned by contentAlignment.

Text tile button

  • Composable: TextTileButton
  • Usage: Selectable items in grids and lists, such as files, apps, or options.
  • Layout: An optional icon above a primary label and an optional secondaryLabel.
  • State: selected and onSelectionChange drive selection, announced with the button role.
import metavrx.uiset.compose.button.TextTileButton

var selected by remember { mutableStateOf(false) }

TextTileButton(
    label = "Meeting notes",
    secondaryLabel = "Edited 2 hours ago",
    icon = { Icon(Icons.Regular.File, contentDescription = null) },
    selected = selected,
    onSelectionChange = { selected = it },
)

Button shelf

  • Composable: ButtonShelf
  • Usage: Persistent modes or destinations in a horizontal row, such as toolbar toggles.
  • Layout: An icon above a label at a fixed shelf size.
  • State: selected and onSelectionChange drive selection.
import metavrx.uiset.compose.button.ButtonShelf

var microphoneOn by remember { mutableStateOf(false) }

ButtonShelf(
    icon = { Icon(Icons.Regular.MicrophoneOn, contentDescription = null) },
    label = "Microphone",
    selected = microphoneOn,
    onSelectionChange = { microphoneOn = it },
)

Common parameters

  • enabled: Boolean = true: Controls interactivity.
  • dimensions: ButtonDimensions: Height, padding, icon, tile, and shelf geometry.
  • modifier: Modifier = Modifier: Applied to the full interaction target.
Choose a style for the emphasis of the action, and a type for whether the button triggers an action or holds a selection.