Components / DropZone
DropZone
Dashed area around any content, which takes dropped files.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn drop_zone() -> impl View {
let count = State::new(0_usize);
let (shown, add) = (count.clone(), count);
DropZone::new(
Text::bound(&shown, |n| format!("{n} files received. Drop more, or press Enter here."))
.style(TextStyle::Callout)
.foreground(Semantic::InkMuted),
)
.label("Files of the session")
.min_height(96.0)
.choosable()
.on_files(move |files| add.update(|n| *n += files.len()))
}