use fission::prelude::*;
fission_component! {
pub AttachmentDropArea<()> {
props { receive_files: ActionEnvelope }
}
view(area, _state, cx) =>
Dropzone(
id: WidgetId::explicit("composer.attachments"),
semantics_identifier: Some("composer.attachments.dropzone".into()),
child: Text(cx.tr("attachment.drop_files")),
active_child: Text(cx.tr("attachment.drag_here")),
hover_child: Text(cx.tr("attachment.release_files")),
on_drop: area.receive_files.clone(),
)
}
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | Option<WidgetId> | Stable identity for the drop surface. | Use explicit IDs for repeated or dynamic dropzones. |
semantics_identifier | Option<String> | Stable semantic/test identifier. | Lets tests target this surface without coordinates. |
child | Widget | Visible content wrapped by the drop surface. | Required. |
active_child | Option<Widget> | Alternate child shown while any drag is active in the window. | Defaults to None, so child remains visible. |
hover_child | Option<Widget> | Alternate child shown while this dropzone is the hovered target. | Defaults to None, so child remains visible. |
on_drop | Option<ActionEnvelope> | Action dispatched when something is dropped on the surface. | Read external paths with ctx.input.as_drop_paths() or internal bytes with ctx.input.as_internal_drop(). |
on_drag_enter | Option<ActionEnvelope> | Action dispatched when a drag enters the bounds. | Useful for setting hover state in GlobalState. |
on_drag_leave | Option<ActionEnvelope> | Action dispatched when a drag leaves the bounds. | Useful for clearing hover state. |