Create a new LayoutSystem instance
Number of grid columns (default: 12)
Gutter size between columns in pixels (default: 20)
Safe area insets for mobile devices
Align element horizontally within container
Width of element to align
Width of container
Alignment type ('left' | 'center' | 'right')
Optional margin from edges
X position for alignment
Align element vertically within container
Height of element to align
Height of container
Alignment type ('top' | 'middle' | 'bottom')
Optional margin from edges
Y position for alignment
Calculate container bounds for arena or game area
Accounts for HUD, controls, and safe areas to determine usable space.
Total screen width
Total screen height
Height of top HUD
Height of bottom controls
Padding around content
Container bounds for game content
Calculate position and width for grid-based layout
Uses 12-column grid system for consistent alignment. Accounts for gutters between columns.
Starting column (0-11)
Number of columns to span (1-12)
Total container width in pixels
OptionalcustomGutter: numberCustom gutter size (optional)
Position and width for the grid cell
Calculate responsive position based on screen size
Scales position proportionally or uses specific overrides for tablet/mobile.
Responsive position configuration
Current screen dimensions and device type
Calculated position for current screen size
Calculate safe position accounting for device notches and home indicators
Ensures UI elements don't overlap with system UI on mobile devices.
Base position
Which edge to apply safe area ('top' | 'bottom' | 'left' | 'right')
Position adjusted for safe area
Create screen size information from dimensions
Determines device type and orientation based on screen dimensions.
Screen width in pixels
Screen height in pixels
ScreenSize object with device type flags
LayoutSystem Class
Provides unified layout calculations and positioning utilities for consistent component placement across all screens.
Example