This commit is contained in:
Khaleel Al-Adhami 2024-10-22 19:00:15 -07:00
parent 42b8586ab9
commit d8962dbc08
2 changed files with 8 additions and 3 deletions

View File

@ -224,7 +224,7 @@ class Upload(MemoizationLeaf):
on_drop: EventHandler[_on_drop_spec] on_drop: EventHandler[_on_drop_spec]
@classmethod @classmethod
def create(cls, *children, multiple=True, **props) -> Component: def create(cls, *children, **props) -> Component:
"""Create an upload component. """Create an upload component.
Args: Args:
@ -238,7 +238,7 @@ class Upload(MemoizationLeaf):
# Mark the Upload component as used in the app. # Mark the Upload component as used in the app.
cls.is_used = True cls.is_used = True
props["multiple"] = multiple props["multiple"].set_default(True)
# Apply the default classname # Apply the default classname
given_class_name = props.pop("class_name", []) given_class_name = props.pop("class_name", [])

View File

@ -6,7 +6,11 @@
from pathlib import Path from pathlib import Path
from typing import Any, ClassVar, Dict, List, Optional, Union, overload from typing import Any, ClassVar, Dict, List, Optional, Union, overload
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf from reflex.components.component import (
Component,
ComponentNamespace,
MemoizationLeaf,
)
from reflex.constants import Dirs from reflex.constants import Dirs
from reflex.event import ( from reflex.event import (
CallableEventSpec, CallableEventSpec,
@ -133,6 +137,7 @@ class Upload(MemoizationLeaf):
Args: Args:
*children: The children of the component. *children: The children of the component.
multiple: Whether to allow multiple files to be uploaded.
accept: The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as values. supported MIME types: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types accept: The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as values. supported MIME types: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
disabled: Whether the dropzone is disabled. disabled: Whether the dropzone is disabled.
max_files: The maximum number of files that can be uploaded. max_files: The maximum number of files that can be uploaded.