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

str
dynamic

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

bool
dynamic

Indicates if this component is active.
An inactive component allows no user interaction.

True

id

str

The identifier that is assigned to the rendered HTML component.

None

properties

dict[str, Any]

Bound to a dictionary that contains additional properties for this element.

None

class_name

str
dynamic

The list of CSS class names that are associated with the generated HTML Element.
These class names are added to the default taipy-file_selector class name.

None

hover_text

str
dynamic

The information that is displayed when the user hovers over this element.

None