- Getting Started
- The Basics
- Concepts
- SuperNative
-
EDGE Components
- Introduction
- Activity Indicator
- Badge
- Bottom Navigation
- Bottom Sheet
- Button
- Button Group
- Canvas
- Carousel
- Checkbox
- Chip
- Column
- Divider
- Gesture Area
- Icon
- Icons
- Image
- Layout & Styling
- List
- Menus
- Modal
- Pressable
- Progress Bar
- Radio Group
- Row
- Scroll View
- Select
- Shapes
- Side Navigation
- Slider
- Spacer
- Stack
- Tab Row
- Text
- Text Input
- Toggle
- Top Bar
- Virtual List
- Web View
- Plugins
- Testing
- Architecture
You're viewing pre-release documentation — version 4.x is in beta
Features, APIs and behaviour may change before the stable release. View the stable version (3.x)
List
Overview#
A virtualized list container. On iOS, renders as a SwiftUI List with native pull-to-refresh and trailing
swipe-to-delete. On Android, renders as a LazyColumn / LazyRow.
Pair with <native:list-item> for Material3 list rows, or use any EDGE element as a child.
<native:list separator on-refresh="refresh" on-end-reached="loadMore"> @foreach($contacts as $contact) <native:list-item headline="{{ $contact->name }}" supporting="{{ $contact->email }}" leadingMonogram="{{ $contact->initials }}" trailingIcon="forward" @press="openContact({{ $contact->id }})" /> @endforeach</native:list>
Props#
horizontal- Lay out children horizontally instead of vertically (optional, boolean, default:false)shows-indicators- Show scroll indicators (optional, boolean, default:false) [iOS]separator- Render dividers between rows (optional, boolean, default:false) [iOS]on-refresh- Livewire method called on pull-to-refresh (optional, string) [iOS]on-end-reached- Livewire method called when the user nears the end of the list (optional, string)
Children#
Accepts any EDGE elements as children. <native:list-item> is the canonical child for Material3-style rows.
List Item#
A pre-styled Material3 row with a headline, optional supporting + overline text, and configurable leading + trailing content slots.
<native:list-item headline="Inbox" supporting="42 unread" leadingIcon="email" trailingIcon="forward" @press="openInbox"/>
Text props#
headline- Primary text (required, string)supporting- Secondary text rendered below the headline (optional, string)overline- Small caption rendered above the headline (optional, string)
Leading slot (mutually exclusive)#
leadingIcon- Icon name rendered as a leading iconleadingAvatar- URL of a circular avatar imageleadingMonogram- 1-2 character monogram (combine withleadingMonogramColor)leadingMonogramColor- Hex color for monogram backgroundleadingImage- URL of a square image with a small radiusleadingCheckbox- Boolean value for a leading checkboxleadingRadio- Boolean value for a leading radio button
Trailing slot (mutually exclusive)#
trailingIcon- Icon name rendered as a trailing icontrailingText- Trailing text labeltrailingCheckbox- Boolean value for a trailing checkboxtrailingSwitch- Boolean value for a trailing switch [Android]trailingIconButton- Icon name for a tappable trailing buttontrailing-a11y-label- Accessibility label for the trailing icon button (recommended whenevertrailingIconButtonis set). See Accessibilitytrailing-menu- Attach a tap-to-open dropdown to the row's trailing edge. See Menus
Independent of the mutually-exclusive slot above, a row can also show a stack of small status icons:
trailing-badges- An array of small status badges drawn right-aligned, so several can show at once (e.g. a flag and a pin). Each badge is['ios' => ..., 'android' => ..., 'color' => '#hex'].
Color overrides#
headlineColor,supportingColor,overlineColor- Hex colors for the text stylescontainerColor- Row background colorleadingIconColor,trailingIconColor,trailingTextColor- Colors for the slot contentleadingIconBgColor- Background color of the leading icon's circle
State#
disabled- Disable the row (optional, boolean, default:false)tonalElevation- Tonal elevation in dp [Android]shadowElevation- Shadow elevation in dp [Android]
Events#
@press/@longPress- Standard press handlers on the row@leading-change- Fired when a leading checkbox or radio toggles; receives the new value@trailing-change- Fired when a trailing checkbox or switch toggles; receives the new value@trailing-press- Fired when the trailing icon button is tappedon-swipe-delete- Shortcut for a single destructive trailing swipe. For anything richer, usetrailing-actionsbelow.
Swipe actions#
Configure swipe actions on either edge with leading-actions and trailing-actions — each an array of action
definitions the user reveals by swiping the row. Each action is an array:
method- Component method to call when the action is tapped (required)label- The action's textios/android- The action icon, resolved per platform (oriconfor a shared name)tint- Background color as a hex stringrole- Set todestructiveto render in the platform's delete style (trailing only)
<native:list-item :headline="$email->subject" :leading-actions="[ ['method' => 'toggleRead('.$email->id.')', 'label' => 'Read', 'ios' => 'envelope.open', 'android' => 'mark_email_read', 'tint' => '#3B82F6'], ]" :trailing-actions="[ ['method' => 'flag('.$email->id.')', 'label' => 'Flag', 'ios' => 'flag', 'android' => 'flag', 'tint' => '#F97316'], ['method' => 'delete('.$email->id.')', 'label' => 'Delete', 'ios' => 'trash', 'android' => 'delete', 'role' => 'destructive'], ]"/>
List Section#
Group rows under a header (and optional footer) with <native:list-section> — a SwiftUI Section on iOS, a
sticky-header group on Android. Place <native:list-item> children inside; a section on its own renders nothing.
<native:list> <native:list-section header="Fruits" footer="2 items"> <native:list-item headline="Apple" /> <native:list-item headline="Banana" /> </native:list-section> <native:list-section header="Vegetables"> <native:list-item headline="Carrot" /> </native:list-section></native:list>
header- Section header textfooter- Optional footer text below the section
use Nativephp\NativeUi\Elements\ListSection; ListSection::make('Fruits', ListItem::make('Apple'))->footer('1 item');
Examples#
Settings menu#
<native:list separator> <native:list-item headline="Profile" leadingIcon="person" trailingIcon="forward" @press="openProfile" /> <native:list-item headline="Notifications" leadingIcon="notifications" trailingIcon="forward" @press="openNotifications" /> <native:list-item headline="Privacy" leadingIcon="lock" trailingIcon="forward" @press="openPrivacy" /> <native:list-item headline="Help" leadingIcon="help" trailingIcon="forward" @press="openHelp" /></native:list>
Swipe-to-delete with pull-to-refresh#
<native:list separator on-refresh="refreshTasks"> @foreach($tasks as $task) <native:list-item headline="{{ $task->title }}" supporting="{{ $task->due }}" leadingCheckbox="{{ $task->done }}" trailingIcon="forward" on-swipe-delete="deleteTask({{ $task->id }})" @press="openTask({{ $task->id }})" /> @endforeach</native:list>
Infinite scroll#
<native:list on-end-reached="loadMore"> @foreach($posts as $post) <native:list-item headline="{{ $post->title }}" supporting="{{ $post->excerpt }}" /> @endforeach</native:list>
Element#
use Nativephp\NativeUi\Elements\NativeList;use Nativephp\NativeUi\Elements\ListItem; NativeList::make( ListItem::make('Profile')->leadingIcon('person')->trailingIcon('forward'), ListItem::make('Settings')->leadingIcon('settings')->trailingIcon('forward'),) ->separator() ->onRefresh('refresh') ->onEndReached('loadMore');
NativeList methods#
make(Element ...$children)- Create a list with childrenhorizontal(bool $value = true)- Horizontal layoutshowsIndicators(bool $value = true)- Show scroll indicatorsseparator(bool $value = true)- Render dividers between rowsonRefresh(string $method)- Pull-to-refresh handleronEndReached(string $method)- End-reached handler
ListItem methods#
Text:
make(string $headline = ''),supporting(string $text),overline(string $text)
Leading slot:
leadingIcon(string $icon)leadingAvatar(string $url)leadingMonogram(string $initials, ?string $color = null)leadingImage(string $url)leadingCheckbox(bool $checked = false)leadingRadio(bool $selected = false)
Trailing slot:
trailingIcon(string $icon)trailingText(string $text)trailingCheckbox(bool $checked = false)trailingSwitch(bool $checked = false)trailingIconButton(string $icon)trailingA11yLabel(string $label)- Accessibility label for the trailing icon button
Swipe actions & badges:
leadingActions(array $actions),trailingActions(array $actions)- Arrays of swipe-action definitions (method,label,ios/android,tint, androlefor trailing)trailingBadges(array $badges)- Stacked right-aligned status icons
Styling:
headlineColor,supportingColor,overlineColor,containerColor,leadingIconColor,trailingIconColor,trailingTextColor(all(string $color))tonalElevation(float $dp),shadowElevation(float $dp)
Callbacks:
onLeadingChange(string $method),onTrailingChange(string $method),onTrailingPress(string $method),onSwipeDelete(string $method)disabled(bool $disabled = true)
in no time