Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 62 additions & 1 deletion resources/views/docs/mobile/4/edge-components/bottom-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,77 @@ Per Material 3, the container color resolves from `theme.surface`. For a custom
- `large`
- `full` (100% of screen)
- A numeric fraction `0.0`–`1.0` for a custom height (e.g. `"0.4"` for 40%)
- `title` - The sheet's title, drawn the way each platform draws its own sheets (optional, string). See
[Titled sheet](#titled-sheet)
- `close-label` - What VoiceOver reads for the close button of a titled iOS sheet (optional, string, default: the
system's own label on iOS 26, "Close" before it). Also accepted as `closeLabel`
- `a11y-label` - Accessibility label (optional)
- `a11y-hint` - Accessibility hint (optional)

## Events

- `@dismiss` - Component method called when the sheet is dismissed (swipe down or tap outside)
- `@dismiss` - Component method called when the sheet is dismissed (swipe down, tap outside, or the close button of a
titled iOS sheet)

## Children

Accepts any EDGE elements as children. The children are rendered inside the sheet's content area.

## Examples

### Titled sheet

Give the sheet a `title` instead of drawing your own heading row. Each platform then draws it the way its own sheets
look:

- **iOS** puts the title in the sheet's navigation bar and adds the system close button on the bar's leading edge,
as Apple's Human Interface Guidelines ask for sheets. On iOS 26 it's the system's close button; on earlier versions,
a filled xmark circle.
- **Android** shows the title as heading text under the drag handle. Material's modal bottom sheet has no close
button, so none is added: people close it by swiping down, tapping the scrim, or pressing back.

@verbatim
```blade
@php
$showFilters = false;
$openNow = false;
$indoorOnly = false;
@endphp

<native:column class="w-full gap-3 items-start">
<native:button label="Filters" @press="$showFilters = true" />

<native:bottom-sheet
:visible="$showFilters"
@dismiss="$showFilters = false"
title="Filters"
:close-label="__('Close')"
detents="medium"
>
<native:column class="w-full p-4 gap-3">
<native:toggle label="Open now" native:model="openNow" />
<native:toggle label="Indoor only" native:model="indoorOnly" />
</native:column>
</native:bottom-sheet>
</native:column>
```
@endverbatim

<aside>

#### The iOS close button is added for you

Don't put your own close button in a titled sheet. On iOS it would appear next to the one the system already shows.
Tapping the system button closes the sheet and calls `@dismiss`, just as swiping down does, so the same handler
covers both.

A `permanent` sheet can't be dismissed, so it gets no close button. Its title still shows.

The package can't translate the close button's VoiceOver label. If your app's language can differ from the device's,
pass your own translation with `close-label`.

</aside>

### Action sheet

@verbatim
Expand Down Expand Up @@ -151,12 +209,15 @@ use Native\Mobile\UI\Elements\BottomSheet;
BottomSheet::make()
->visible($showSheet)
->detents('medium,large')
->title('Filters')
->onDismiss('hideSheet');
```

- `make()` - Create a bottom sheet
- `visible(bool $value = true)` - Toggle visibility
- `detents(string $detents)` - Allowed heights
- `title(string $title)` - The sheet's title; an empty string leaves the sheet untitled
- `closeLabel(string $label)` - VoiceOver label for the close button of a titled iOS sheet
- `a11yLabel(string $value)` - Accessibility label
- `a11yHint(string $value)` - Accessibility hint
- `onDismiss(string $method)` - Component method invoked on dismissal