docs(media): add standalone package guide
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: Asset picker
|
||||
description: Reuse the media library as a controlled single- or multiple-selection dialog.
|
||||
order: 30
|
||||
toc:
|
||||
- id: open-the-picker
|
||||
title: Open the picker
|
||||
- id: constrain-selection
|
||||
title: Constrain selection
|
||||
- id: consume-results
|
||||
title: Consume results
|
||||
---
|
||||
|
||||
## Open the picker {#open-the-picker}
|
||||
|
||||
`MediaPickerDialog` reuses the same adapter and folder model as the full library:
|
||||
|
||||
```tsx
|
||||
import { MediaPickerDialog } from "@workspace/media"
|
||||
|
||||
;<MediaPickerDialog
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
onConfirm={(assets) => editor.insertImages(assets)}
|
||||
/>
|
||||
```
|
||||
|
||||
## Constrain selection {#constrain-selection}
|
||||
|
||||
Pass `allowedKinds={["image"]}` for an image-only workflow. The dialog selects one asset by default; pass `multiple` when the consumer accepts several assets, and provide `initialSelection` when editing an existing value.
|
||||
|
||||
## Consume results {#consume-results}
|
||||
|
||||
The confirmation callback receives complete `MediaAsset` records. Store the adapter-provided reference rather than a temporary preview URL when the result must survive signed-URL expiration.
|
||||
Reference in New Issue
Block a user