### View Quick Start
Source: https://phaserjsx.number10.de/components/view
Basic visible container example. Ensure a background color or content is added to make the view visible.
```typescript
/**
* View Quick Start Example - Basic visible container
* Note: An empty View is invisible. Add background color or content to make it visible.
*/
/** @jsxImportSource @number10/jsx-core */
import { Text, View } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
export const quickStartViewExampleMeta: ExampleMeta = {
id: 'view-quick-start',
title: 'View Quick Start',
description: 'Basic visible container — add background color or content to make it visible.',
category: 'layout',
tags: ['view', 'layout'],
height: 200,
}
export default function QuickStartViewExample(): VNodeLike {
return (
)
}
```
--------------------------------
### onTooltip Usage Examples
Source: https://phaserjsx.number10.de/api/core-props
Examples for implementing simple, conditional, and configured tooltips.
```jsx
// Simple text tooltip
"Click to delete"} />
// Conditional tooltip
isAdmin ? "Admin action" : null} />
// Full configuration
({
content: "Delete item",
position: "top",
showDelay: 100
})} />
```
--------------------------------
### onReady Usage Examples
Source: https://phaserjsx.number10.de/api/core-props
Examples for accessing Phaser GameObjects after creation.
```jsx
// Display image dimensions
console.log(`${img.width}x${img.height}`)}
/>
// Access View bounds
console.log(view.getBounds())}
/>
```
--------------------------------
### Install dependencies
Source: https://phaserjsx.number10.de/guides/three-panels
Install the required core, component, and peer dependencies for the project.
```bash
pnpm add @number10/jsx-core @number10/jsx-components @number10/jsx-konva @number10/jsx-three
pnpm add react react-dom konva three @react-three/fiber @react-three/drei
```
--------------------------------
### Visibility approaches comparison example
Source: https://phaserjsx.number10.de/guides/best-practices
A comprehensive example demonstrating the three visibility strategies within a state-driven component.
```jsx
/**
* Visibility Example - Demonstrates different approaches to showing/hiding components
*/
/** @jsxImportSource @number10/phaserjsx */
import { Text, View } from '@number10/jsx-components'
import { useEffect, useState } from '@number10/jsx-core'
/**
* Demonstrates three different approaches to controlling component visibility in PhaserJSX
*/
export function VisibilityExample() {
const [test, setTest] = useState(0)
useEffect(() => {
const interval = setInterval(() => {
setTest((t) => t + 1)
}, 2000)
return () => clearInterval(interval)
}, [])
const isOdd = test % 2 === 1
return (
{/* Test 1: visible=false - Child should toggle visibility, but stay took place */}
{/* Test 2: visible="none" - Child should toggle visibility, parent should re-layout */}
{/* Test 3: Conditional rendering - Child should be added/removed from VDOM */}
}`}
style={{ fontSize: '12px' }}
/>
{isOdd && }
)
}
```
--------------------------------
### Start Development Server
Source: https://phaserjsx.number10.de/guides/testing
Commands to launch the documentation site development server.
```bash
cd apps/docs-site
pnpm dev
```
--------------------------------
### Install Konva Dependencies
Source: https://phaserjsx.number10.de/installation
Install the core, components, and Konva-specific renderer packages.
```bash
pnpm add @number10/jsx-core @number10/jsx-components @number10/jsx-konva konva
```
--------------------------------
### Create Button Quick Start Component
Source: https://phaserjsx.number10.de/guides/testing
Defines a basic PhaserJSX component with a click handler for the quick start example.
```typescript
/**
* Button Quick Start Example
*/
/** @jsxImportSource @number10/phaserjsx */
import { Button, Text, View } from '@number10/phaserjsx'
export function QuickStartButtonExample() {
return (
console.log('Clicked!')}>
)
}
```
--------------------------------
### Install Portable Dependencies
Source: https://phaserjsx.number10.de/installation
Install only the core and components packages for library development.
```bash
pnpm add @number10/jsx-core @number10/jsx-components
```
--------------------------------
### Install PixiJS Dependencies
Source: https://phaserjsx.number10.de/installation
Install the core, components, and PixiJS-specific renderer packages.
```bash
pnpm add @number10/jsx-core @number10/jsx-components @number10/jsx-pixi pixi.js
```
--------------------------------
### Install PhaserJSX dependencies
Source: https://phaserjsx.number10.de/
Use this command to install the core framework, components, and Phaser renderer integration.
```bash
pnpm add @number10/jsx-core @number10/jsx-components @number10/jsx-phaser phaser
```
--------------------------------
### Generator Output Example
Source: https://phaserjsx.number10.de/guides/custom-svg-icons
Example console output showing the icon scanning and generation process.
```text
🎨 Icon Generator
📝 Generating icon types...
📦 Scanning package: bootstrap-icons
✓ Found 2078 icons from Bootstrap Icons
📁 Scanning directory: ./src/custom-icons
✓ Found 3 icons from Custom Icons
✓ Total unique icons: 2081
✓ Generated: icon-types.generated.ts
⚡ Generating icon loaders...
✓ Found 5 unique icons
Icons: check, gear, custom-logo, custom-check, custom-plus
✓ Generated: icon-loaders.generated.ts
```
--------------------------------
### Creating Themes
Source: https://phaserjsx.number10.de/api/theme-types
Example of defining a complete theme and shared portable overrides.
```typescript
import { createTheme, type Theme } from '@number10/phaserjsx'
import type { PortablePartialTheme } from '@number10/jsx-components'
// Complete theme
const darkTheme: Theme = {
View: {
backgroundColor: 0x1a1a1a,
cornerRadius: 8,
},
Text: {
style: {
fontFamily: 'Inter',
fontSize: '16px',
color: '#ffffff',
},
},
// ... all other built-in components
}
// Shared portable override map
const customizations: PortablePartialTheme = {
Button: {
backgroundColor: 0xff0000,
},
Icon: {
size: 28,
},
}
```
--------------------------------
### Initialize Theme System State
Source: https://phaserjsx.number10.de/guides/theme-system
Example of managing theme modes and presets within a component.
```typescript
export function ThemeSystemDocumentationExample() {
const [mode, setMode] = useState('dark')
const [alertsEnabled, setAlertsEnabled] = useState(true)
const [compactMode, setCompactMode] = useState(false)
const preset = getPresetWithMode('oceanBlue', mode)
const { colors } = preset
```
--------------------------------
### View Icon Directory Structure
Source: https://phaserjsx.number10.de/guides/custom-svg-icons
Example of a recommended file structure for organizing icons by category.
```text
src/icons/
├── brand/
│ ├── company-logo.svg
│ └── partner-logo.svg
├── products/
│ ├── product-a-icon.svg
│ └── product-b-icon.svg
└── illustrations/
├── hero-illustration.svg
└── error-illustration.svg
```
--------------------------------
### Text Quick Start
Source: https://phaserjsx.number10.de/components/text
Basic Text component with default and styled text.
```typescript
/**
* Text Quick Start Example
*/
/** @jsxImportSource @number10/jsx-core */
import { Text, View } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
export const quickStartTextExampleMeta: ExampleMeta = {
id: 'text-quick-start',
title: 'Text Quick Start',
description: 'Basic Text component with default and styled text.',
category: 'text',
tags: ['text', 'typography'],
height: 200,
}
export default function QuickStartTextExample(): VNodeLike {
return (
)
}
```
--------------------------------
### Keyboard and Input Event Usage
Source: https://phaserjsx.number10.de/api/core-props
Example implementation of keyboard and input event handlers.
```jsx
console.log('Key pressed:', e.key)}
onInput={(e) => console.log('Input value:', e.value)}
onFocus={() => console.log('Focused')}
/>
```
--------------------------------
### Toggle Quick Start
Source: https://phaserjsx.number10.de/components/toggle
Basic implementation of a controlled toggle switch with state management.
```jsx
/**
* Toggle Quick Start Example
*/
/** @jsxImportSource @number10/jsx-core */
import { Text, Toggle, View } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
import { useState } from '@number10/jsx-core'
export const quickStartToggleExampleMeta: ExampleMeta = {
id: 'toggle-quick-start',
title: 'Toggle Quick Start',
description: 'Basic toggle switch with on/off states.',
category: 'inputs',
tags: ['toggle', 'input'],
height: 300,
}
export default function QuickStartToggleExample(): VNodeLike {
const [isEnabled, setIsEnabled] = useState(false)
return (
)
}
```
--------------------------------
### WheelPicker Quick Start
Source: https://phaserjsx.number10.de/components/wheel-picker
Basic implementation of a wheel picker for selecting difficulty levels.
```typescript
/** @jsxImportSource @number10/jsx-core */
import type { WheelPickerItem } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
import { Text, View, WheelPicker } from '@number10/jsx-components'
import { useState } from '@number10/jsx-core'
const items: WheelPickerItem[] = [
{ value: 'easy', label: 'Easy' },
{ value: 'normal', label: 'Normal' },
{ value: 'hard', label: 'Hard' },
{ value: 'expert', label: 'Expert' },
{ value: 'nightmare', label: 'Nightmare' },
]
export const quickStartWheelPickerExampleMeta: ExampleMeta = {
id: 'wheelpicker-quick-start',
title: 'WheelPicker Quick Start',
description: 'Basic wheel picker for option selection.',
category: 'inputs',
tags: ['wheelpicker', 'input', 'selection'],
height: 300,
}
export default function QuickStartWheelPickerExample(): VNodeLike {
const [selected, setSelected] = useState('normal')
return (
)
}
```
--------------------------------
### Tooltip Quick Start
Source: https://phaserjsx.number10.de/guides/tooltips
Basic implementation of tooltips on buttons, including conditional content logic.
```jsx
/**
* Tooltip Quick Start Example
*/
/** @jsxImportSource @number10/phaserjsx */
import { Button, Text, View } from '@number10/jsx-components'
export function QuickStartTooltipExample() {
return (
'Primary action'}>
'Secondary action'}>
(Math.random() > 0.5 ? 'Lucky!' : 'Unlucky!')}>
)
}
```
--------------------------------
### ListBox Quick Start
Source: https://phaserjsx.number10.de/components/listbox
Basic implementation of a ListBox with predefined items and state-managed selection.
```typescript
/** @jsxImportSource @number10/jsx-core */
import type { ListBoxItem } from '@number10/jsx-components'
import { ListBox, Text, View } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
import { useState } from '@number10/jsx-core'
const items: ListBoxItem[] = [
{ value: 'player', label: 'Player Settings' },
{ value: 'graphics', label: 'Graphics' },
{ value: 'audio', label: 'Audio' },
{ value: 'controls', label: 'Controls' },
{ value: 'network', label: 'Network', disabled: true },
{ value: 'language', label: 'Language' },
]
export const quickStartListBoxExampleMeta: ExampleMeta = {
id: 'listbox-quick-start',
title: 'ListBox Quick Start',
description: 'Basic listbox with option selection.',
category: 'inputs',
tags: ['listbox', 'input', 'selection'],
height: 300,
}
export default function QuickStartListBoxExample(): VNodeLike {
const [selected, setSelected] = useState('graphics')
return (
i.value === selected)?.label ?? selected}`} />
)
}
```
--------------------------------
### Install PhaserJSX and Phaser
Source: https://phaserjsx.number10.de/installation
Use this command to add the compatibility package and Phaser dependency to your project.
```bash
pnpm add @number10/phaserjsx phaser
```
--------------------------------
### Implement a Quick Start MenuButton
Source: https://phaserjsx.number10.de/components/menu-button
Demonstrates a standard file action menu with item callbacks, icons, and selection feedback.
```typescript
/** @jsxImportSource @number10/phaserjsx */
import { Icon } from '@/components/Icon'
import { MenuButton, Text, View, type ContextMenuItem } from '@number10/jsx-components'
import { useState } from '@number10/jsx-core'
export function QuickStartMenuButtonExample() {
const [lastAction, setLastAction] = useState('None')
const items: ContextMenuItem[] = [
{
id: 'save',
label: 'Save',
prefix: ,
},
{
id: 'open',
label: 'Open folder',
prefix: ,
},
{
id: 'export',
label: 'Export',
prefix: ,
},
{
id: 'delete',
label: 'Delete',
danger: true,
prefix: ,
},
]
return (
}
items={items}
width={190}
onSelect={(item) => setLastAction(item.label)}
/>
)
}
```
--------------------------------
### Image Quick Start
Source: https://phaserjsx.number10.de/components/image
Demonstrates basic image loading and rendering using the useTexture hook to manage asset readiness.
```jsx
/**
* Image Quick Start - Basic image loading via useTexture hook
*/
/** @jsxImportSource @number10/phaserjsx */
import { resolveAssetPath } from '@/utils/assetPath'
import { Image, Text, View } from '@number10/jsx-components'
import { useTexture } from '@number10/jsx-core'
export function QuickStartImageExample() {
const test = useTexture('test', resolveAssetPath('assets/images/test.png'))
const back = useTexture('back', resolveAssetPath('assets/images/back.png'))
const line = useTexture('wideline', resolveAssetPath('assets/images/wideline.png'))
const ready = test.ready && back.ready && line.ready
return (
{ready && (
)}
)
}
```
--------------------------------
### TransformProps Usage Examples
Source: https://phaserjsx.number10.de/api/core-props
Examples for applying position, rotation, and scaling transformations.
```jsx
// Position
// Rotation (radians)
// Scale
```
--------------------------------
### Basic Phaser Scene Setup
Source: https://phaserjsx.number10.de/installation
Demonstrates manual component mounting within a Phaser scene using mountJSX.
```typescript
/**
* Basic Phaser 4 scene setup — Phaser Direct
* Components from @number10/jsx-components, mountJSX from @number10/jsx-phaser.
*/
/** @jsxImportSource @number10/jsx-phaser */
import { Button, Text, View } from '@number10/jsx-components'
import { mountJSX } from '@number10/jsx-phaser'
import * as Phaser from 'phaser'
class GameScene extends Phaser.Scene {
constructor() {
super({ key: 'GameScene' })
}
create() {
// Mount your PhaserJSX component tree
mountJSX(this, MainUI, { width: this.scale.width, height: this.scale.height })
}
}
// Your component using PhaserJSX
function MainUI() {
return (
console.log('Clicked!')}>
)
}
export { GameScene }
```
--------------------------------
### Configure Global Theme
Source: https://phaserjsx.number10.de/guides/theme-system
Initialize a theme using color presets and semantic tokens for consistent component styling.
```javascript
import { createTheme, getPresetWithMode } from '@number10/phaserjsx'
// Get preset with color mode
const preset = getPresetWithMode('oceanBlue', 'light')
const { colors } = preset
// Create theme using color tokens
const theme = createTheme({
Text: {
style: {
color: colors.text.DEFAULT.toString(), // Semantic token
fontSize: '16px',
fontFamily: 'Arial'
}
},
View: {
backgroundColor: colors.surface.light.toNumber(),
borderColor: colors.border.medium.toNumber(),
cornerRadius: 8
},
Button: {
backgroundColor: colors.primary.DEFAULT.toNumber(),
borderColor: colors.primary.dark.toNumber(),
textStyle: {
color: colors.text.lightest.toString()
}
}
})
```
--------------------------------
### Alpha Usage Example
Source: https://phaserjsx.number10.de/api/core-props
Applies transparency to a View component.
```jsx
Semi-transparent
```
--------------------------------
### Full Icon Generator Configuration
Source: https://phaserjsx.number10.de/guides/icon-generator-config
A complete configuration example demonstrating icon sources, type generation, loader settings, and custom detection patterns.
```typescript
import { defineIconConfig } from '@number10/jsx-icon-generator/icon-generator-config'
export default defineIconConfig({
// Multiple icon sources
source: [
{
package: 'bootstrap-icons',
iconsPath: 'icons',
label: 'Bootstrap Icons',
},
{
directory: './src/custom-icons',
label: 'Custom Icons',
},
],
// Type generation
types: {
enabled: true,
scanIconDirectory: 'start', // Once at server start
output: './src/components/Icon/icon-types.generated.ts',
typeName: 'IconType',
},
// Loader generation
loaders: {
enabled: true,
generateLoaders: 'watch', // Regenerate on code changes
output: './src/components/Icon/icon-loaders.generated.ts',
scanDir: './src',
componentNames: ['Icon', 'BootstrapIcon'],
validate: true, // Warn about missing icons
},
// Custom detection patterns
customPatterns: [
{
name: 'Theme icon properties',
pattern: '(\w*[Ii]con):\s*["'](\w+)["']',
captureGroup: 2,
},
],
// Exclude directories
exclude: ['node_modules', 'dist', '.git', 'build'],
})
```
--------------------------------
### Wheel Event Usage
Source: https://phaserjsx.number10.de/api/core-props
Example implementation of a wheel event handler.
```jsx
console.log('Scrolled:', e.deltaX, e.deltaY)}
/>
```
--------------------------------
### Implement Phaser Direct Application
Source: https://phaserjsx.number10.de/quick-start
A complete example showing component definition, scene integration, and Phaser game configuration.
```typescript
/** @jsxImportSource @number10/jsx-phaser */
import * as Phaser from 'phaser'
import { Button, Text, View } from '@number10/jsx-components'
import { useState } from '@number10/jsx-core'
import { mountJSX } from '@number10/jsx-phaser'
function Counter() {
const [count, setCount] = useState(0)
return (
setCount(count - 1)}>
setCount(count + 1)}>
setCount(0)}>
)
}
class GameScene extends Phaser.Scene {
constructor() { super({ key: 'GameScene' }) }
create() {
mountJSX(this, Counter, { width: this.scale.width, height: this.scale.height })
}
}
const config: Phaser.Types.Core.GameConfig = {
type: Phaser.AUTO, width: 800, height: 600,
parent: 'game-container', backgroundColor: '#ffffff',
scene: [GameScene],
}
new Phaser.Game(config)
```
--------------------------------
### Example NineSliceTheme usage
Source: https://phaserjsx.number10.de/api/theme-types
Configuration object for a NineSlice component theme.
```typescript
NineSlice: {
texture: 'panel',
leftWidth: 10,
rightWidth: 10,
topHeight: 10,
bottomHeight: 10,
}
```
--------------------------------
### Quick Start Badge and Tag Implementation
Source: https://phaserjsx.number10.de/components/badge
Demonstrates basic usage of Badge for notifications and Tag for filter labels within a PhaserJSX view.
```jsx
/**
* Badge Quick Start Example
*/
/** @jsxImportSource @number10/phaserjsx */
import { Badge, Button, Tag, Text, View } from '@number10/jsx-components'
import { useState } from '@number10/jsx-core'
export function QuickStartBadgeExample() {
const [notifications, setNotifications] = useState(3)
return (
setNotifications((value) => Math.max(0, value - 1))}
>
setNotifications((value) => value + 5)}>
)
}
```
--------------------------------
### Example IconTheme usage
Source: https://phaserjsx.number10.de/api/theme-types
Configuration object for an Icon component theme.
```typescript
Icon: {
size: 24,
color: 0x6b7280,
strokeWidth: 2,
}
```
--------------------------------
### Example TextTheme usage
Source: https://phaserjsx.number10.de/api/theme-types
Configuration object for a Text component theme.
```typescript
Text: {
style: {
fontFamily: 'Inter',
fontSize: '16px',
color: '#1f2937',
align: 'left',
},
maxWidth: 600,
}
```
--------------------------------
### Render a Sprite with Quick Start
Source: https://phaserjsx.number10.de/components/sprite
Demonstrates basic sprite rendering by defining a texture and applying position and scale properties. Requires preloading the texture asset in the scene.
```typescript
/**
* Sprite Quick Start Example
*/
/** @jsxImportSource @number10/phaserjsx */
import { resolveAssetPath } from '@/utils/assetPath'
import { Sprite } from '@number10/phaserjsx'
import { Text, View } from '@number10/jsx-components'
export function QuickStartSpriteExample() {
return (
)
}
// eslint-disable-next-line react-refresh/only-export-components
export function preloadQuickStartSprite(scene: Phaser.Scene) {
scene.load.image('sprite-eye', resolveAssetPath('assets/images/lance-overdose-loader-eye.png'))
}
```
--------------------------------
### Example ViewTheme usage
Source: https://phaserjsx.number10.de/api/theme-types
Configuration object for a View component theme.
```typescript
View: {
backgroundColor: 0xf3f4f6,
cornerRadius: 8,
padding: 16,
gap: 12,
// Nested component themes
Text: {
style: { color: '#111827' },
},
}
```
--------------------------------
### Dropdown Quick Start
Source: https://phaserjsx.number10.de/components/dropdown
Basic implementation of a single-select dropdown component.
```typescript
/**
* Dropdown Quick Start Example
*/
/** @jsxImportSource @number10/jsx-core */
import { Dropdown, Text, View, type DropdownOption } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
import { useState } from '@number10/jsx-core'
const fruits: DropdownOption[] = [
{ value: 'apple', label: 'Apple' },
{ value: 'banana', label: 'Banana' },
{ value: 'cherry', label: 'Cherry' },
{ value: 'orange', label: 'Orange' },
]
export const quickStartDropdownExampleMeta: ExampleMeta = {
id: 'dropdown-quick-start',
title: 'Dropdown Quick Start',
description: 'Basic dropdown with option selection.',
category: 'inputs',
tags: ['dropdown', 'input', 'selection'],
height: 300,
}
export default function QuickStartDropdownExample(): VNodeLike {
const [selected, setSelected] = useState('')
return (
f.value === selected)?.label || 'None'}`}
style={{ color: '#aaaaaa', fontSize: '14px' }}
/>
setSelected(value as string)}
placeholder="Choose a fruit..."
width={250}
maxHeight={200}
/>
)
}
```
--------------------------------
### Layout Debugging with useLayoutRect
Source: https://phaserjsx.number10.de/api/hooks
Example of using useLayoutRect to display dimensions of a container.
```typescript
function LayoutDebug() {
const ref = useRef(null)
const rect = useLayoutRect(ref)
return (
)
}
```
--------------------------------
### Joystick Quick Start
Source: https://phaserjsx.number10.de/components/joystick
Basic implementation of a virtual joystick with real-time position feedback using state hooks.
```typescript
/**
* Joystick Quick Start Example - Basic usage
*/
/** @jsxImportSource @number10/jsx-core */
import { Joystick, Text, View } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
import { useState } from '@number10/jsx-core'
export const quickStartJoystickExampleMeta: ExampleMeta = {
id: 'joystick-quick-start',
title: 'Joystick Quick Start',
description: 'Basic virtual joystick with position feedback.',
category: 'interactions',
tags: ['joystick', 'interactions'],
height: 300,
}
export default function QuickStartJoystickExample(): VNodeLike {
const [angle, setAngle] = useState(0)
const [force, setForce] = useState(0)
return (
{
if (active) {
setAngle(angle)
setForce(force)
}
}}
/>
)
}
```
--------------------------------
### Create Documentation Page
Source: https://phaserjsx.number10.de/guides/testing
Implements the React page layout for rendering component documentation and live examples.
```typescript
/** @jsxImportSource react */
import {
DocDescription,
ExampleSection,
InheritedProps,
PropsTable,
Section,
ToggleButton,
} from '@/components/Doc'
import { CodeBlock, LiveExample } from '@/components/Example'
import { DocLayout } from '@/components/Layout'
import { buttonContent } from '@/content/button.content'
export function ButtonPage() {
return (
{buttonContent.title}
{buttonContent.description}
createPhaserScene(buttonContent.quickStart.component)}
height={buttonContent.quickStart.height}
/>
{/* More sections... */}
)
}
```
--------------------------------
### Usage in Examples
Source: https://phaserjsx.number10.de/guides/scene-backgrounds
Configuration for adding background properties to component documentation definitions.
```typescript
import { SCENE_SIZES } from '@/constants/scene-sizes'
import type { ComponentDocs } from '@/types/docs'
export const myContent: ComponentDocs = {
quickStart: {
id: 'quick-start',
component: MyComponent,
height: SCENE_SIZES.medium,
// Optional background configuration
background: {
type: 'grid',
animation: 'lemniscate',
opacity: 0.2,
color: 0x4a9eff,
},
code: `...`,
},
}
```
--------------------------------
### Gesture Configuration Usage
Source: https://phaserjsx.number10.de/api/core-props
Example of overriding default gesture timing values.
```jsx
console.log('Long pressed')}
/>
```
--------------------------------
### Depth Usage Example
Source: https://phaserjsx.number10.de/api/core-props
Controls rendering order using the depth property.
```jsx
Background
Content
Overlay
```
--------------------------------
### Overflow Usage Example
Source: https://phaserjsx.number10.de/api/core-props
Demonstrates clipping content within a View container.
```jsx
```
--------------------------------
### Configure Icon Sources
Source: https://phaserjsx.number10.de/guides/icon-generator-config
Examples for defining icon sources from npm packages, local directories, or a combination of both.
```typescript
source: [
{
package: 'bootstrap-icons', // npm package name
iconsPath: 'icons', // Path to icons within package
label: 'Bootstrap Icons', // Display label in logs
},
]
```
```typescript
source: [
{
directory: './src/custom-icons', // Path to local SVG files
label: 'Custom Icons', // Display label in logs
},
]
```
```typescript
source: [
{
package: 'bootstrap-icons',
iconsPath: 'icons',
label: 'Bootstrap Icons',
},
{
directory: './src/custom-icons',
label: 'Custom Icons',
},
{
package: 'feather-icons',
iconsPath: 'dist/icons',
label: 'Feather Icons',
},
]
```
--------------------------------
### Initialize theme system imports
Source: https://phaserjsx.number10.de/guides/theme-system
Standard imports required for setting up the theme system and component definitions in a project.
```typescript
/**
* Theme system documentation sample
*/
/** @jsxImportSource @number10/phaserjsx */
import {
Button,
Text,
View,
WrapText,
type PortableComponentPartialTheme,
type PortableComponentThemes,
} from '@number10/jsx-components'
import {
createTheme,
getGlobalThemeDefaults,
getPresetWithMode,
KNOWN_COMPONENTS,
mergeThemes,
registerComponentThemeDefaults,
resolveComponentTheme,
useMemo,
useState,
useTheme,
type NestedComponentThemes,
type PortableTextStyle,
} from '@number10/jsx-core'
type Mode = 'light' | 'dark'
```
--------------------------------
### Responsive Viewport Playground Implementation
Source: https://phaserjsx.number10.de/guides/responsive-design
A comprehensive example demonstrating dynamic UI adaptation based on viewport dimensions using state-driven layout adjustments.
```typescript
/**
* Responsive Viewport Playground Example
*/
/** @jsxImportSource @number10/phaserjsx */
import type { SizeValue } from '@number10/phaserjsx'
import { Button, Divider, Text, View } from '@number10/jsx-components'
import { useState } from '@number10/jsx-core'
type ViewportPreset = {
id: 'phone' | 'tablet' | 'desktop'
label: string
width: number
height: number
}
const VIEWPORTS: ViewportPreset[] = [
{ id: 'phone', label: 'Phone', width: 250, height: 420 },
{ id: 'tablet', label: 'Tablet', width: 420, height: 330 },
{ id: 'desktop', label: 'Desktop', width: 560, height: 330 },
]
const TEXT = { color: '#f8fafc', fontSize: '12px' }
const MUTED = { color: '#94a3b8', fontSize: '11px' }
function PresetButton({
preset,
active,
onClick,
}: {
key?: string
preset: ViewportPreset
active: boolean
onClick: () => void
}) {
return (
)
}
function Meter({ label, width, color }: { label: string; width: SizeValue; color: number }) {
return (
)
}
function InfoCard({ title, value, accent }: { title: string; value: string; accent: number }) {
return (
)
}
function SimulatedApp({ viewport }: { viewport: ViewportPreset }) {
const compact = viewport.width < 320
const roomy = viewport.width >= 500
return (
```
--------------------------------
### Compare Static vs Dynamic Icon Imports
Source: https://phaserjsx.number10.de/guides/icon-system
Demonstrates the difference between bundling all icons via static imports and optimizing bundle size using dynamic imports.
```javascript
// ❌ All 2000+ icons in bundle
import check from 'bootstrap-icons/icons/check.svg'
import gear from 'bootstrap-icons/icons/gear.svg'
// ... 2000+ more imports
const icons = { check, gear, ... }
```
```javascript
// ✅ Only used icons in bundle
export const iconLoaders = {
'check': () => import('bootstrap-icons/icons/check.svg'),
'gear': () => import('bootstrap-icons/icons/gear.svg'),
// Only icons found in your code
}
```
--------------------------------
### Opacity & Visibility Configuration
Source: https://phaserjsx.number10.de/components/view
Example metadata for controlling alpha transparency and visibility properties.
```typescript
/**
* View Alpha & Visibility Example - Opacity and visibility control
*/
/** @jsxImportSource @number10/jsx-core */
import { ScrollView, Text, View } from '@number10/jsx-components'
import type { VNodeLike } from '@number10/jsx-core'
import type { ExampleMeta } from '../types'
export const alphaVisibilityViewExampleMeta: ExampleMeta = {
id: 'view-alpha-visibility',
title: 'Opacity & Visibility',
description: 'Alpha transparency and visible prop control.',
category: 'layout',
tags: ['view', 'layout'],
height: 500,
}
```
--------------------------------
### Verify Runtime Rendering
Source: https://phaserjsx.number10.de/guides/custom-icon-component
Example usage of the Icon component within a view layout.
```typescript
function IconTest() {
return (
)
}
```
--------------------------------
### Generated Icon Type Definition
Source: https://phaserjsx.number10.de/guides/custom-icon-component
Example of the auto-generated union type for icon names.
```typescript
/**
* Auto-generated icon type definitions
*/
export type IconType =
| 'check'
| 'gear'
| 'star'
// ... 2000+ more
```