Vue NativeVue Native
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
  • Layout

    • VView
    • VScrollView
    • VSafeArea
    • VKeyboardAvoiding
  • Text & Input

    • VText
    • VInput
  • Interactive

    • VButton
    • VPressable
    • VSwitch
    • VSlider
    • VSegmentedControl
    • VCheckbox
    • VRadio
    • VDropdown
    • VRefreshControl
  • Media

    • VImage
    • VWebView
    • VVideo
  • Lists

    • VList
    • VFlatList
    • VSectionList
  • Feedback

    • VActivityIndicator
    • VProgressBar
    • VAlertDialog
    • VActionSheet
    • VModal
    • VErrorBoundary
  • Transition & State

    • VTransition & VTransitionGroup
    • KeepAlive
    • VSuspense
  • Navigation

    • VNavigationBar
    • VTabBar
  • System

    • VStatusBar
    • VPicker
  • macOS

    • VToolbar
    • VSplitView
    • VOutlineView

VButton

A pressable container view. Maps to a UIControl-based view on iOS and a custom touch delegate on Android.

Unlike web buttons, VButton is a layout container -- place VText or other views inside it.

Usage

<VButton
  :style="{ backgroundColor: '#007AFF', padding: 12, borderRadius: 8 }"
  :onPress="handlePress"
>
  <VText :style="{ color: '#fff', fontWeight: '600' }">Tap me</VText>
</VButton>

Props

PropTypeDefaultDescription
styleStyleProp--Layout + appearance styles
disabledbooleanfalseDisable press interactions
activeOpacitynumber0.7Opacity when the button is pressed (0.0 to 1.0)
onPressFunction--Callback fired on tap
onLongPressFunction--Callback fired on long press (~500ms)
accessibilityLabelstring--Accessible description
accessibilityRolestring--Accessibility role
accessibilityHintstring--Additional accessibility context
accessibilityStateobject--Accessibility state (e.g. { disabled: true })

Warning

VButton uses props for press handlers (:onPress, :onLongPress), not Vue events (@press). This is because native press handling is passed directly to the native view factory.

Example

<script setup>
import { ref } from '@thelacanians/vue-native-runtime'

const count = ref(0)
const submit = () => count.value++
</script>

<template>
  <VView :style="{ padding: 20, gap: 12 }">
    <VButton :style="styles.button" :onPress="submit">
      <VText :style="styles.label">Pressed {{ count }} times</VText>
    </VButton>

    <VButton :style="styles.button" :disabled="true">
      <VText :style="styles.label">Disabled</VText>
    </VButton>

    <VButton
      :style="styles.outline"
      :onPress="() => console.log('Long press supported')"
      :onLongPress="() => console.log('Long pressed!')"
    >
      <VText :style="styles.outlineLabel">Long press me</VText>
    </VButton>
  </VView>
</template>

<script>
import { createStyleSheet } from '@thelacanians/vue-native-runtime'

const styles = createStyleSheet({
  button: {
    backgroundColor: '#007AFF',
    paddingHorizontal: 24,
    paddingVertical: 12,
    borderRadius: 8,
    alignItems: 'center',
  },
  label: {
    color: '#fff',
    fontSize: 16,
    fontWeight: '600',
  },
  outline: {
    borderWidth: 1,
    borderColor: '#007AFF',
    paddingHorizontal: 24,
    paddingVertical: 12,
    borderRadius: 8,
    alignItems: 'center',
  },
  outlineLabel: {
    color: '#007AFF',
    fontSize: 16,
    fontWeight: '600',
  },
})
</script>
Edit this page
Last Updated: 2/28/26, 11:24 PM
Contributors: Abdul Hamid, Claude Opus 4.6
Next
VPressable