OWL
data_display
Dropzone
Odoo 19 OWL component — Dropzone (core)
Live preview
Interactive
Source excerpt
web/static/src/core/dropzone/dropzone.js
import { Component, useEffect, useRef, useState } from "@odoo/owl";
export class Dropzone extends Component {
static props = {
extraClass: { type: String, optional: true },
onDrop: { type: Function, optional: true },
ref: [Object, Function],
slots: { type: Object, optional: true },
};
static template = "web.Dropzone";
setup() {
super.setup();
this.root = useRef("root");
this.state = useState({
isDraggingInside: false,
});
useEffect(() => {
const { top, left, width, height } = this.props.ref.el.getBoundingClientRect();
this.root.el.style = `top:${top}px;left:${left}px;width:${width}px;height:${height}px;`;
});
}
}
Registry / API
- Registry name
Dropzone- Category
—- Module
web- Slug
dropzone- Nav group
data_display