PhotosPicker
PhotosPicker opens an image-only asset chooser and forwards selected files, keeping SwiftUI's media selection intent while relying on the browser's native file picker.
PhotosPicker opens an image-only asset chooser and forwards selected files, keeping SwiftUI's media selection intent while relying on the browser's native file picker.
Examples
Examples
Preview unavailable for this example in the static docs build.
Examples
Preview unavailable for this example in the static docs build.
Show code
<PhotosPicker maxSelectionCount={4}>Choose gallery items</PhotosPicker>Examples
Preview unavailable for this example in the static docs build.
Show code
<PhotosPicker matching="videos" maxSelectionCount={2}>Choose clips</PhotosPicker>API
| Prop | Type | Required | Description |
|---|---|---|---|
selectionLimit | number | No | Maximum number of selected items. Values above 1 enable multi-select. |
maxSelectionCount | number | No | SwiftUI-aligned alias for the maximum number of selected items. |
matching | 'images' | 'videos' | 'any' | No | Preferred media type filter. Default: 'images' |
onSelect | (files: Array<globalThis.File>) => void | Yes | Called with the selected image files. |
Inherits additional props from Omit<IBaseElementComponent<'button'>, 'type' | 'onSelect'>.
PhotosPicker opens an image-only asset chooser and forwards selected files, keeping SwiftUI's media selection intent while relying on the browser's native file picker.
Status: adapted
SwiftUI Correspondence: Adapted from SwiftUI's PhotosPicker.
Notes
- The current web implementation selects image files via a hidden
input[type="file"]. maxSelectionCountandmatchingare the preferred SwiftUI-aligned props.selectionLimittrims the forwarded files to the requested maximum when the SwiftUI alias is not provided.- The hidden input resets after each selection so the same asset can be chosen again.
- The browser controls the actual picker UI.