A dialog for selecting files or directories in the filesystem.
[FileDialog] is a preset dialog used to choose files and directories in the filesystem. It supports filter masks. [FileDialog] automatically sets its window title according to the [member file_mode]. If you want to use a custom title, disable this by setting [member mode_overrides_title] to [code]false[/code]. [b]Note:[/b] [FileDialog] is invisible by default. To make it visible, call one of the [code]popup_*[/code] methods from [Window] on the node, such as [method Window.popup_centered_clamped].
Adds a comma-separated file extension [param filter] and comma-separated MIME type [param mime_type] option to the [FileDialog] with an optional [param description], which restricts what files can be picked. A [param filter] should be of the form [code]"filename.extension"[/code], where filename and extension can be [code]*[/code] to match any string. Filters starting with [code].[/code] (i.e. empty filenames) are not allowed. For example, a [param filter] of [code]"*.png, *.jpg"[/code], a [param mime_type] of [code]image/png, image/jpeg[/code], and a [param description] of [code]"Images"[/code] results in filter text "Images (*.png, *.jpg)". [b]Note:[/b] Embedded file dialogs and Windows file dialogs support only file extensions, while Android, Linux, and macOS file dialogs also support MIME types.
Adds an additional [OptionButton] to the file dialog. If [param values] is empty, a [CheckBox] is added instead. [param default_value_index] should be an index of the value in the [param values]. If [param values] is empty it should be either [code]1[/code] (checked), or [code]0[/code] (unchecked).
Clear the filter for file names.
Clear all the added filters in the dialog.
Clear all currently selected items in the dialog.
Returns the list of favorite directories, which is shared by all [FileDialog] nodes. Useful to store the list of favorites between project sessions. This method can be called only from the main thread.
Returns the LineEdit for the selected file. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
Returns the default value index of the [OptionButton] or [CheckBox] with index [param option].
Returns the name of the [OptionButton] or [CheckBox] with index [param option].
Returns an array of values of the [OptionButton] with index [param option].
Returns the list of recent directories, which is shared by all [FileDialog] nodes. Useful to store the list of recents between project sessions. This method can be called only from the main thread.
Returns a [Dictionary] with the selected values of the additional [OptionButton]s and/or [CheckBox]es. [Dictionary] keys are names and values are selected value indices.
Returns the vertical box container of the dialog, custom controls can be added to it. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property. [b]Note:[/b] Changes to this node are ignored by native file dialogs, use [method add_option] to add custom elements to the dialog instead.
Invalidates and updates this dialog's content list. [b]Note:[/b] This method does nothing on native file dialogs.
Returns [code]true[/code] if the provided [param flag] is enabled.
Shows the [FileDialog] using the default size and position for file dialogs, and selects the file name if there is a current file.
Sets the specified customization [param flag], allowing to customize the features available in this [FileDialog].
Sets the list of favorite directories, which is shared by all [FileDialog] nodes. Useful to restore the list of favorites saved with [method get_favorite_list]. This method can be called only from the main thread. [b]Note:[/b] [FileDialog] will update its internal [ItemList] of favorites when its visibility changes. Be sure to call this method earlier if you want your changes to have effect.
Sets the callback used by the [FileDialog] nodes to get a file icon, when [constant DISPLAY_LIST] mode is used. The callback should take a single [String] argument (file path), and return a [Texture2D]. If an invalid texture is returned, the [theme_item file] icon will be used instead.
Sets the callback used by the [FileDialog] nodes to get a file icon, when [constant DISPLAY_THUMBNAILS] mode is used. The callback should take a single [String] argument (file path), and return a [Texture2D]. If an invalid texture is returned, the [theme_item file_thumbnail] icon will be used instead. Thumbnails are usually more complex and may take a while to load. To avoid stalling the application, you can use [ImageTexture] to asynchronously create the thumbnail. [codeblock] func _ready(): FileDialog.set_get_thumbnail_callback(thumbnail_method)

func thumbnail_method(path): var image_texture = ImageTexture.new() make_thumbnail_async(path, image_texture) return image_texture

func make_thumbnail_async(path, image_texture): var thumbnail_texture = await generate_thumbnail(path) # Some method that generates a thumbnail. image_texture.set_image(thumbnail_texture.get_image()) [/codeblock]
Sets the default value index of the [OptionButton] or [CheckBox] with index [param option].
Sets the name of the [OptionButton] or [CheckBox] with index [param option].
Sets the option values of the [OptionButton] with index [param option].
Sets the list of recent directories, which is shared by all [FileDialog] nodes. Useful to restore the list of recents saved with [method set_recent_list]. This method can be called only from the main thread. [b]Note:[/b] [FileDialog] will update its internal [ItemList] of recent directories when its visibility changes. Be sure to call this method earlier if you want your changes to have effect.
- The file system access scope. [b]Warning:[/b] In Web builds, FileDialog cannot access the host file system. In sandboxed Linux and macOS environments, [member use_native_dialog] is automatically used to allow limited access to host file system.
- The current working directory of the file dialog. [b]Note:[/b] For native file dialogs, this property is only treated as a hint and may not be respected by specific OS implementations.
- The currently selected file of the file dialog.
- The currently selected file path of the file dialog.
- If [code]true[/code], the context menu will show the "Delete" option, which allows moving files and folders to trash.
- Display mode of the dialog's file list.
- If [code]true[/code], shows the toggle favorite button and favorite list on the left side of the dialog.
- If [code]true[/code], shows the toggle file filter button.
- The dialog's open or save mode, which affects the selection behavior.
- If [code]true[/code], shows the file sorting options button.
- The filter for file names (case-insensitive). When set to a non-empty string, only files that contains the substring will be shown. [member filename_filter] can be edited by the user with the filter button at the top of the file dialog. See also [member filters], which should be used to restrict the file types that can be selected instead of [member filename_filter] which is meant to be set by the user.
- The available file type filters. Each filter string in the array should be formatted like this: [code]*.png,*.jpg,*.jpeg;Image Files;image/png,image/jpeg[/code]. The description text of the filter is optional and can be omitted. Both file extensions and MIME type should be always set. [b]Note:[/b] Embedded file dialogs and Windows file dialogs support only file extensions, while Android, Linux, and macOS file dialogs also support MIME types.
- If [code]true[/code], shows the button for creating new directories (when using [constant FILE_MODE_OPEN_DIR], [constant FILE_MODE_OPEN_ANY], or [constant FILE_MODE_SAVE_FILE]), and the context menu will have the "New Folder..." option.
- If [code]true[/code], shows the toggle hidden files button.
- If [code]true[/code], shows the layout switch buttons (list/thumbnails).
- If [code]true[/code], changing the [member file_mode] property will set the window title accordingly (e.g. setting [member file_mode] to [constant FILE_MODE_OPEN_FILE] will change the window title to "Open a File").
- The number of additional [OptionButton]s and [CheckBox]es in the dialog.
- If [code]true[/code], the [FileDialog] will warn the user before overwriting files in save mode.
- If [code]true[/code], shows the recent directories list on the left side of the dialog.
- If non-empty, the given sub-folder will be "root" of this [FileDialog], i.e. user won't be able to go to its parent directory. [b]Note:[/b] This property is ignored by native file dialogs.
- If [code]true[/code], the dialog will show hidden files. [b]Note:[/b] This property is ignored by native file dialogs on Android and Linux.
- If [code]true[/code], and if supported by the current [DisplayServer], OS native dialog will be used instead of custom one. [b]Note:[/b] On Android, it is only supported when using [constant ACCESS_FILESYSTEM]. For access mode [constant ACCESS_RESOURCES] and [constant ACCESS_USERDATA], the system will fall back to custom FileDialog. [b]Note:[/b] On Linux and macOS, sandboxed apps always use native dialogs to access the host file system. [b]Note:[/b] On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use [method OS.get_granted_permissions] to get a list of saved bookmarks. [b]Note:[/b] Native dialogs are isolated from the base process, file dialog properties can't be modified once the dialog is shown. [b]Note:[/b] This property is ignored in [EditorFileDialog].
Emitted when the user selects a directory.
Emitted when the user selects a file by double-clicking it or pressing the [b]OK[/b] button.
Emitted when the filter for file names changes.
Emitted when the user selects multiple files.
The dialog allows selecting one, and only one file.
The dialog allows selecting multiple files.
The dialog only allows selecting a directory, disallowing the selection of any file.
The dialog allows selecting one file or directory.
The dialog will warn when a file exists.
The dialog only allows accessing files under the [Resource] path ([code]res://[/code]).
The dialog only allows accessing files under user data path ([code]user://[/code]).
The dialog allows accessing files on the whole file system.
The dialog displays files as a grid of thumbnails. Use [theme_item thumbnail_size] to adjust their size.
The dialog displays files as a list of filenames.
Toggles visibility of the favorite button, and the favorite list on the left side of the dialog. Equivalent to [member hidden_files_toggle_enabled].
If enabled, shows the button for creating new directories (when using [constant FILE_MODE_OPEN_DIR], [constant FILE_MODE_OPEN_ANY], or [constant FILE_MODE_SAVE_FILE]). Equivalent to [member folder_creation_enabled].
If enabled, shows the toggle file filter button. Equivalent to [member file_filter_toggle_enabled].
If enabled, shows the file sorting options button. Equivalent to [member file_sort_options_enabled].
If enabled, shows the toggle favorite button and favorite list on the left side of the dialog. Equivalent to [member favorites_enabled].
If enabled, shows the recent directories list on the left side of the dialog. Equivalent to [member recent_list_enabled].
If enabled, shows the layout switch buttons (list/thumbnails). Equivalent to [member layout_toggle_enabled].
If enabled, the [FileDialog] will warn the user before overwriting files in save mode. Equivalent to [member overwrite_warning_enabled].
If enabled, the context menu will show the "Delete" option, which allows moving files and folders to trash. Equivalent to [member deleting_enabled].
The color tint for disabled files (when the [FileDialog] is used in open folder mode).
The color modulation applied to the file icon.
The color modulation applied to the folder icon.
The size of thumbnail icons when [constant DISPLAY_THUMBNAILS] is enabled.
Custom icon for the back arrow.
Custom icon for the create folder button.
Custom icon for favorite folder button.
Custom icon for button to move down a favorite entry.
Custom icon for button to move up a favorite entry.
Custom icon for files.
Icon for files when in thumbnail mode.
Custom icon for folders.
Icon for folders when in thumbnail mode.
Custom icon for the forward arrow.
Icon for the button that enables list mode.
Icon for the "Copy Path" context menu option.
Icon for the "Delete" context menu option.
Icon for the "New Folder..." context menu option. Usually it should be the same as [theme_item create_folder]; leave it empty if you want the context menu to show no icons.
Icon for the "Show Package Contents" context menu option. The option only appears for macOS bundles.
Icon for the "Refresh" context menu option. Usually it should be the same as [theme_item reload]; leave it empty if you want the context menu to show no icons.
Icon for the "Show in File Manager" context menu option.
Custom icon for the parent folder arrow.
Custom icon for the reload button.
Custom icon for the sorting options menu.
Icon for the button that enables thumbnail mode.
Custom icon for the toggle button for the filter for file names.
Custom icon for the toggle hidden button.