smrt
Open the smrt source on GitHub Switch to dark color scheme
← All UI components

Assets · Components

CreateAssetModal

Upload/create new assets. Modal with drag-and-drop dropzone, paste support, and metadata fields. When a file is pasted or dragged onto the AssetManager, this modal opens with the file pre-loaded.

Public export

typescript
import { CreateAssetModal } from '@happyvertical/smrt-assets/svelte';
Import path
@happyvertical/smrt-assets/svelte
Props
4
Props described
4 of 4
Bindable state
0
Callback events
2
Verified release
0.62.10

Props

NameTypeRequiredDescription
openbooleanYesWhether the modal is open
initialFileFile | nullNoPre-loaded file (from paste or drag)
oncreate(data: { file: File; name: string; description: string; altText: string; }) => void | Promise<void>YesCallback when creation is complete. May be async; a rejection keeps the form populated and surfaces an error instead of clearing silently.
onclose() => voidYesCallback when modal is closed

Bindable state

This component has no bindable public state.

Callback events

  • oncreate(data: { file: File; name: string; description: string; altText: string; }) => void | Promise<void>
  • onclose() => void

Examples and explanation