- Getting Started
- Architecture
- The Basics
- Digging Deeper
-
EDGE Components
- Introduction
- Activity Indicator
- Badge
- Bottom Navigation
- Bottom Sheet
- Button
- Button Group
- Canvas
- Carousel
- Checkbox
- Chip
- Column
- Divider
- Gesture Area
- Icon
- Image
- Lazy Grid
- Layout & Styling
- List
- Menus
- Modal
- Pressable
- Progress Bar
- Radio Group
- Refreshable
- Row
- Scroll View
- Select
- Shapes
- Side Navigation
- Slider
- Spacer
- Stack
- Tab Row
- Text
- Text Input
- Toggle
- Top Bar
- Virtual List
- Web View
- Plugins
- Testing
- Publishing Your App
Modal
Get the Jump app
You'll need the free Jump app to preview this page on your device. Install it, then scan the code again.
Overview#
A full-screen modal overlay. Visibility is driven by the visible prop. Use a bottom sheet for
contextual actions; reach for <native:modal> when you want the entire screen covered (e.g. an onboarding flow,
image preview, or detail view).
Per Material 3, backdrop and surface colors come from theme.background. The close icon uses theme.onSurfaceVariant.
Copied!
@php $showDetails = false; $description = 'Everything about the selected item goes here.';@endphp <native:column class="w-full gap-3 items-start"> <native:button label="View details" @press="$showDetails = true" /> <native:modal :visible="$showDetails" @dismiss="$showDetails = false"> <native:column class="w-full h-full p-4 gap-4 safe-area"> <native:text class="text-2xl font-bold text-theme-on-surface">Details</native:text> <native:text class="text-base text-theme-on-surface-variant">{{ $description }}</native:text> </native:column> </native:modal></native:column>
Props#
visible- Whether the modal is shown (required, boolean)dismissible- Render a close icon and allow swipe-to-dismiss (optional, boolean, default:true)a11y-label- Accessibility label (optional)a11y-hint- Accessibility hint (optional)
Events#
@dismiss- Component method called when the user dismisses the modal (close button tap or swipe). Always handle this to keep yourvisiblestate in sync
Children#
Accepts any EDGE elements as children. The children are rendered inside the modal's content area below the
auto-supplied close button (when dismissible).
Examples#
Image preview#
Copied!
@php $showImage = false; $previewUrl = 'https://picsum.photos/800/1200';@endphp <native:column class="w-full gap-3 items-start"> <native:button label="Preview image" @press="$showImage = true" /> <native:modal :visible="$showImage" @dismiss="$showImage = false"> <native:column class="w-full h-full" center> <native:image src="{{ $previewUrl }}" class="w-full" :fit="1" /> </native:column> </native:modal></native:column>
Non-dismissible loading modal#
Copied!
@php $processing = false; @endphp <native:column class="w-full gap-3 items-start"> <native:button label="Start processing" @press="$processing = true" /> <native:modal :visible="$processing" :dismissible="false"> <native:column fill center :gap="16"> <native:activity-indicator size="lg" /> <native:text class="text-base text-theme-on-surface">Processing...</native:text> {{-- A real app closes this from PHP when the work finishes; the button stands in for that here since the modal can't be dismissed by the user. --}} <native:button label="Done" variant="secondary" @press="$processing = false" /> </native:column> </native:modal></native:column>
Element#
Copied!
use Nativephp\NativeUi\Elements\Modal; Modal::make() ->visible($showDetails) ->dismissible(true) ->onDismiss('closeDetails');
make()- Create a modalvisible(bool $value = true)- Toggle visibilitydismissible(bool $value = true)- Allow user dismissala11yLabel(string $value)- Accessibility labela11yHint(string $value)- Accessibility hintonDismiss(string $method)- Component method invoked on dismissal
NativePHP
Bring your
Laravel
skills to the
desktop.
Cloud Platform
Bifrost
Build your NativePHP apps
in the cloud.
Ship it!
Plans from $10/mo
Plugin Dev Kit
Build native plugins with
Claude Code
Learn More
NativePHP Ultra
All NativePHP plugins, teams & priority support from
$35/mo
Learn More
The Vibes
The unofficial Laracon US
Day 3
Grab Your Spot
Only 100 tickets!
The Masterclass
Go from zero to
published app
in no time
in no time
Learn More