Skip to content

file_selector class

Allows uploading a file content.

Methods

__init__()

__init__(
    content=None,
    label=None,
    on_action=None,
    multiple=False,
    extensions=".csv,.xlsx",
    drop_message="Drop here to Upload",
    notify=True,
    width=None,
    active=True,
    id=None,
    properties=None,
    class_name=None,
    hover_text=None,
) -> None

Create a new file_selector element.

Parameters:

Name Type Description Default
content dynamic(str)

The path or the list of paths of the uploaded files.

None
label str

The label of the button.

None
on_action Union[str, Callable]

A function or the name of a function that will be triggered.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • id (str): the identifier of the button if it has one.
  • payload (dict): a dictionary that contains the key "action" set to the name of the action that triggered this callback.

None
multiple bool

If set to True, multiple files can be uploaded.

False
extensions str

The list of file extensions that can be uploaded.

.csv,.xlsx
drop_message str

The message that is displayed when the user drags a file above the button.

Drop here to Upload
notify bool

If set to False, the user won't be notified of upload finish.

True
width Union[str, int]

The width of the element.

None
active dynamic(bool)

Indicates if this element is active.
If False, the element is disabled, and user interaction is not allowed.

True
id str

The identifier assigned to the rendered HTML component.
This can be used in callbacks or to target the element for styling.

None
properties dict[str, Any]

A dictionary of additional properties that can be set to the element.

None
class_name dynamic(str)

A space-separated list of CSS class names to be applied to the generated HTML element.
These classes are added to the default taipy-file_selector class.

None
hover_text dynamic(str)

The text that is displayed when the user hovers over the element.

None