🚧 VeloxKit is pre-release software. APIs may change before v1.0. Get started →
Documentation
Components
Pressable

Pressable Stable WINMACLNX

The standard interaction primitive. Use Pressable anywhere you need a tappable or clickable element.

Import

import { Pressable } from 'veloxkit'

Basic usage

<Pressable onPress={() => console.log('pressed!')}>
  <Text>Click me</Text>
</Pressable>

Dynamic style on state

style accepts a function that receives the current interaction state:

<Pressable
  style={({ pressed, hovered, focused }) => ({
    padding: '10px 20px',
    borderRadius: 8,
    background: pressed
      ? '#007A58'
      : hovered
      ? '#00C98E'
      : '#00A878',
    transform: pressed ? [{ scale: 0.97 }] : [],
    opacity: focused ? 1 : undefined,
    borderWidth: focused ? 2 : 0,
    borderColor: '#6BDFB8',
  })}
  onPress={handleSubmit}
>
  <Text style={{ color: '#fff', fontWeight: 600 }}>Submit</Text>
</Pressable>

Props

PropTypeDescription
onPress() => voidCalled on tap/click release
onPressIn() => voidCalled on pointer/touch down
onPressOut() => voidCalled on pointer/touch up
onLongPress() => voidCalled after 500ms hold
onHoverIn() => voidCalled on pointer enter
onHoverOut() => voidCalled on pointer leave
onFocus() => voidCalled on keyboard focus
onBlur() => voidCalled on keyboard blur
disabledbooleanDisables all interactions
styleViewStyle | (state) => ViewStyleStatic or dynamic style
hitSlopnumber | InsetsExpand the hit area
delayLongPressnumberms before onLongPress fires (default 500)

Right-click / context menu

<Pressable
  onPress={openItem}
  onContextMenu={(e) => {
    e.preventDefault()
    showContextMenu(e.nativeEvent.pageX, e.nativeEvent.pageY)
  }}
>
  <Text>{item.name}</Text>
</Pressable>

Keyboard interaction

Pressable is keyboard-accessible by default. Space and Enter trigger onPress when focused.

Pressable does not render any visual appearance on its own. Apply styles to communicate interactivity to users — at minimum, a hovered style change.