ui/drop_zone
Types
pub type DropEffect {
Copy
Move
Link
Execute
None
}
Constructors
-
Copy -
Move -
Link -
Execute -
None
Values
pub fn aria_describedby(id: String) -> attribute.Attribute(a)
pub fn aria_dropeffect(
effect: DropEffect,
) -> attribute.Attribute(a)
pub fn aria_label(label: String) -> attribute.Attribute(a)
pub fn drop_zone(
attributes: List(attribute.Attribute(a)),
children: List(element.Element(a)),
) -> element.Element(a)
Drop zone component with optional file input for click-to-browse.
When input_attributes is provided, clicking the drop zone will trigger
the file browser. When input_attributes is None, the drop zone is
visual-only (for drag-and-drop only).
Example
// With click-to-browse
drop_zone.drop_zone(
[drop_zone.input_attributes([file_trigger.input([attribute("accept", ".png,.jpg")])])],
[text("Drop files here or click to browse")]
)
// Visual-only (drag-and-drop only)
drop_zone.drop_zone(
[],
[text("Drop files here")]
)
pub fn drop_zone_with_input(
input_attributes: List(attribute.Attribute(a)),
children: List(element.Element(a)),
) -> element.Element(a)
Wraps drop zone children with a label element to enable click-to-browse. The label wraps the content and contains a hidden file input.
Parameters
input_attributes: Attributes for the hidden file input (e.g., accept, multiple)children: The drop zone content
Example
drop_zone.drop_zone_with_input(
[file_trigger.input([attribute("accept", ".png,.jpg"), attribute("multiple", "true")])],
[
text("📁"),
p([], [text("Drop files here or click to browse")])
]
)
pub fn size(s: Size) -> attribute.Attribute(a)
pub fn variant(v: Variant) -> attribute.Attribute(a)