How Components Work
Native UI components are automatically registered as Blade components with thenative- prefix. The registration process (from NativeServiceProvider.php:330-372):
- Scans the
src/Edge/Components/directory recursively - Converts class names to kebab-case (e.g.,
BottomNav→bottom-nav) - Registers each as a Blade component with the
native-prefix - Results in components like
<x-native-bottom-nav>,<x-native-top-bar>, etc.
Basic Usage Pattern
All native components extend theEdgeComponent base class and follow a consistent pattern:
Component Features
- Type Safety: Components validate required props at render time
- Native Rendering: Props are converted to platform-native configurations
- Child Support: Container components (like
bottom-nav,side-nav,top-bar) can contain child items - Blade Integration: Full support for Blade syntax, variables, and directives
Available Components
Navigation Components
Bottom Navigation
Bottom navigation bar with tabs for primary app destinations
Side Navigation
Drawer-style navigation that slides in from the side
Top Bar
App bar with title, subtitle, and action buttons
Floating Action Button
Prominent circular button for primary actions
Component Hierarchy
Many navigation components work together in parent-child relationships: Bottom Navigation<x-native-bottom-nav>(parent)<x-native-bottom-nav-item>(children)
<x-native-side-nav>(parent)<x-native-side-nav-header>(optional header)<x-native-side-nav-item>(direct items)<x-native-side-nav-group>(collapsible groups)<x-native-side-nav-item>(nested items)
<x-native-horizontal-divider>(visual separator)
<x-native-top-bar>(parent)<x-native-top-bar-action>(action buttons)
Component Registration Details
The component registration happens automatically when NativePHP Mobile boots. From the source code:BottomNav.php→<x-native-bottom-nav>SideNavItem.php→<x-native-side-nav-item>TopBarAction.php→<x-native-top-bar-action>
Validation and Error Handling
Components automatically validate required props. If you forget a required prop, you’ll get a clear error message:MissingRequiredPropsException with details about which props are missing.
Next Steps
Bottom Navigation
Learn how to create tabbed navigation
Side Navigation
Build drawer-style navigation menus
Top Bar
Add app bars with titles and actions
FAB
Implement floating action buttons