KitFileDropZone
File drop target enabled by an actual host capability.

Set DropCapability.available only after checking the backend. Inspect formats in can-drop(DropEvent) and resolve native data asynchronously in dropped.
Both callbacks return an explicit DragAction. In .unsupported mode the zone explains the alternative; pointer events alone do not establish external drop support.
Complete example
This complete Slint file is a visual composition used to produce the screenshot above. Internal strings without a label property retain the kit’s default language; system dialogs follow the host platform. Projected state and callbacks requesting a decision need host wiring; the standalone fixture does not supply that controller. Set up the Rust project, then see the typed controller application for working editing, validation and selection.
// SPDX-License-Identifier: GPL-3.0-or-later
import { DropCapability, KitButton, KitFileDropZone, KitTheme, KitThemes } from "@kit/kit.slint";
export component Example inherits Window {
title: "KitFileDropZone example";
preferred-width: 520px;
preferred-height: 270px;
max-width: 100000px;
max-height: 100000px;
background: root.theme.canvas;
in-out property <KitTheme> theme: KitThemes.light;
in-out property <string> status;
VerticalLayout {
padding: 24px; spacing: 16px; alignment: start;
Text { text: "File Drop Zone"; color: root.theme.text-primary; font-size: 20px * root.theme.text-scale; font-weight: 600; }
KitFileDropZone { theme: root.theme; capability: DropCapability.unsupported; } KitButton { theme: root.theme; text: "Choose files…"; activated => { root.status = "Action requested"; } }
if root.status != "": Text { text: root.status; color: root.theme.text-secondary; font-size: 12px * root.theme.text-scale; wrap: word-wrap; }
}
}
Public API
Inherits Rectangle.
The declarations below come from the component source. Parent properties remain available; see the controller guide for state management.
Properties
| Name | Type | Direction |
|---|---|---|
theme |
KitTheme |
in |
control-size |
ControlSize |
in |
access |
FieldAccess |
in |
capability |
DropCapability |
in |
label |
string |
in |
unsupported-label |
string |
in |
error |
string |
in |
host-drag-hovered |
bool |
in |
drag-hovered |
bool |
out |
Types and variants
Names below use Slint syntax. Shared Rust domain types live in slint_kit; presentation enums come from the Rust types generated by Slint.
| Type | Declaration |
|---|---|
enum ControlSize |
compact, medium, comfortable |
enum DropCapability |
unsupported, available |
enum FieldAccess |
editable, read-only, disabled |
Callbacks
can-drop(DropEvent) → DragActiondropped(DropEvent) → DragAction