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

View Stable WINMACLNX

The fundamental layout primitive. Every UI in VeloxKit is built from nested View components.

View maps to a native flexbox container. It has no visual appearance by default — use style to apply background colors, borders, padding, and layout.

Import

import { View } from 'veloxkit'

Basic usage

<View style={{ flex: 1, padding: 24 }}>
  <Text>Hello</Text>
</View>

Props

PropTypeDefaultDescription
styleViewStyle{}Layout and appearance styles
onLayout(event: LayoutEvent) => voidCalled when the view's layout changes
testIDstringUsed by testing utilities
accessiblebooleantrueWhether the view is accessible
accessibilityLabelstringLabel for screen readers
accessibilityRolestringARIA-equivalent role hint
pointerEvents'auto' | 'none' | 'box-none''auto'Controls hit testing

CSS-compatible flex defaults

View uses the same flex defaults as CSS:

PropertyDefaultCSS equivalent
flexDirection'column'flex-direction: column
justifyContent'flex-start'justify-content: flex-start
alignItems'stretch'align-items: stretch

Children without an explicit cross-axis size stretch to fill their container width (column) or height (row), just as in a browser. To center children, pass alignItems: 'center' explicitly.

Style properties

View supports all flexbox layout properties plus visual styling:

<View style={{
  // Layout
  flex: 1,
  flexDirection: 'row',    // 'column' (default), 'row', 'row-reverse', 'column-reverse'
  flexWrap: 'wrap',
  alignItems: 'center',    // 'flex-start', 'flex-end', 'center', 'stretch', 'baseline'
  justifyContent: 'space-between',
  gap: 12,
  rowGap: 8,
  columnGap: 16,
 
  // Sizing
  width: 200,
  height: 100,
  minWidth: 100,
  maxWidth: '80%',         // percentages supported
 
  // Spacing
  padding: 16,
  paddingHorizontal: 20,
  paddingVertical: 12,
  margin: 8,
 
  // Visual
  background: '#1A1A26',
  borderRadius: 8,
  borderWidth: 1,
  borderColor: '#2A2A3A',
  opacity: 0.9,
 
  // Shadows
  shadowColor: '#000',
  shadowOffset: { width: 0, height: 4 },
  shadowOpacity: 0.3,
  shadowRadius: 8,
 
  // Positioning
  position: 'absolute',
  top: 0,
  left: 0,
  zIndex: 10,
  overflow: 'hidden',      // clips children
}} />

Layout event

<View
  onLayout={(e) => {
    const { x, y, width, height } = e.nativeEvent.layout
    console.log(`View is ${width}×${height} at (${x}, ${y})`)
  }}
/>

onLayout fires after the layout pass, which happens asynchronously relative to the React commit. Use it for measuring, not for computing initial styles (which would cause a layout loop).

Accessibility

<View
  accessible
  accessibilityRole="button"
  accessibilityLabel="Submit form"
>
  <Text>Submit</Text>
</View>

VeloxKit exposes accessible views to the OS accessibility tree (VoiceOver on macOS, Narrator on Windows, AT-SPI on Linux).