Index: uspace/app/uidemo/uidemo.c
===================================================================
--- uspace/app/uidemo/uidemo.c	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/app/uidemo/uidemo.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -40,4 +40,5 @@
 #include <str.h>
 #include <ui/entry.h>
+#include <ui/filedialog.h>
 #include <ui/fixed.h>
 #include <ui/image.h>
@@ -85,6 +86,17 @@
 };
 
+static void uidemo_file_load(ui_menu_entry_t *, void *);
 static void uidemo_file_message(ui_menu_entry_t *, void *);
 static void uidemo_file_exit(ui_menu_entry_t *, void *);
+
+static void file_dialog_bok(ui_file_dialog_t *, void *, const char *);
+static void file_dialog_bcancel(ui_file_dialog_t *, void *);
+static void file_dialog_close(ui_file_dialog_t *, void *);
+
+static ui_file_dialog_cb_t file_dialog_cb = {
+	.bok = file_dialog_bok,
+	.bcancel = file_dialog_bcancel,
+	.close = file_dialog_close
+};
 
 static void msg_dialog_button(ui_msg_dialog_t *, void *, unsigned);
@@ -191,12 +203,13 @@
 }
 
-/** File/message menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_file_message(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
+/** Display a message window.
+ *
+ * @param demo UI demo
+ * @param caption Window caption
+ * @param text Message text
+ */
+static void uidemo_show_message(ui_demo_t *demo, const char *caption,
+    const char *text)
+{
 	ui_msg_dialog_params_t mdparams;
 	ui_msg_dialog_t *dialog;
@@ -204,4 +217,54 @@
 
 	ui_msg_dialog_params_init(&mdparams);
+	mdparams.caption = caption;
+	mdparams.text = text;
+
+	rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
+	if (rc != EOK) {
+		printf("Error creating message dialog.\n");
+		return;
+	}
+
+	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
+}
+
+
+/** File/load menu entry selected.
+ *
+ * @param mentry Menu entry
+ * @param arg Argument (demo)
+ */
+static void uidemo_file_load(ui_menu_entry_t *mentry, void *arg)
+{
+	ui_demo_t *demo = (ui_demo_t *) arg;
+	ui_file_dialog_params_t fdparams;
+	ui_file_dialog_t *dialog;
+	errno_t rc;
+
+	ui_file_dialog_params_init(&fdparams);
+	fdparams.caption = "Load File";
+
+	rc = ui_file_dialog_create(demo->ui, &fdparams, &dialog);
+	if (rc != EOK) {
+		printf("Error creating message dialog.\n");
+		return;
+	}
+
+	ui_file_dialog_set_cb(dialog, &file_dialog_cb, demo);
+}
+
+/** File/message menu entry selected.
+ *
+ * @param mentry Menu entry
+ * @param arg Argument (demo)
+ */
+static void uidemo_file_message(ui_menu_entry_t *mentry, void *arg)
+{
+	ui_demo_t *demo = (ui_demo_t *) arg;
+	ui_msg_dialog_params_t mdparams;
+	ui_msg_dialog_t *dialog;
+	errno_t rc;
+
+	ui_msg_dialog_params_init(&mdparams);
 	mdparams.caption = "Message For You";
 	mdparams.text = "Hello, world!";
@@ -214,5 +277,4 @@
 
 	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
-
 }
 
@@ -227,4 +289,73 @@
 
 	ui_quit(demo->ui);
+}
+
+/** File dialog OK button press.
+ *
+ * @param dialog File dialog
+ * @param arg Argument (ui_demo_t *)
+ * @param fname File name
+ */
+static void file_dialog_bok(ui_file_dialog_t *dialog, void *arg,
+    const char *fname)
+{
+	ui_demo_t *demo = (ui_demo_t *) arg;
+	char buf[128];
+	char *p;
+	FILE *f;
+
+	ui_file_dialog_destroy(dialog);
+
+	f = fopen(fname, "rt");
+	if (f == NULL) {
+		uidemo_show_message(demo, "Error", "Error opening file.");
+		return;
+	}
+
+	p = fgets(buf, sizeof(buf), f);
+	if (p == NULL) {
+		uidemo_show_message(demo, "Error", "Error reading file.");
+		fclose(f);
+		return;
+	}
+
+	/* Cut string off at the first non-printable character */
+	p = buf;
+	while (*p != '\0') {
+		if (*p < ' ') {
+			*p = '\0';
+			break;
+		}
+		++p;
+	}
+
+	ui_entry_set_text(demo->entry, buf);
+	fclose(f);
+}
+
+/** File dialog cancel button press.
+ *
+ * @param dialog File dialog
+ * @param arg Argument (ui_demo_t *)
+ */
+static void file_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
+{
+	ui_demo_t *demo = (ui_demo_t *) arg;
+
+	(void) demo;
+	ui_file_dialog_destroy(dialog);
+}
+
+/** Message dialog close request.
+ *
+ * @param dialog File dialog
+ * @param arg Argument (ui_demo_t *)
+ */
+static void file_dialog_close(ui_file_dialog_t *dialog, void *arg)
+{
+	ui_demo_t *demo = (ui_demo_t *) arg;
+
+	(void) demo;
+	ui_file_dialog_destroy(dialog);
 }
 
@@ -271,4 +402,5 @@
 	gfx_coord2_t off;
 	ui_menu_entry_t *mmsg;
+	ui_menu_entry_t *mload;
 	ui_menu_entry_t *mfoo;
 	ui_menu_entry_t *mbar;
@@ -342,4 +474,12 @@
 	ui_menu_entry_set_cb(mmsg, uidemo_file_message, (void *) &demo);
 
+	rc = ui_menu_entry_create(demo.mfile, "Load", "", &mload);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	ui_menu_entry_set_cb(mload, uidemo_file_load, (void *) &demo);
+
 	rc = ui_menu_entry_create(demo.mfile, "Foo", "Ctrl-Alt-Del", &mfoo);
 	if (rc != EOK) {
Index: uspace/lib/ui/include/types/ui/filedialog.h
===================================================================
--- uspace/lib/ui/include/types/ui/filedialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
+++ uspace/lib/ui/include/types/ui/filedialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2021 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libui
+ * @{
+ */
+/**
+ * @file File dialog
+ */
+
+#ifndef _UI_TYPES_FILEDIALOG_H
+#define _UI_TYPES_FILEDIALOG_H
+
+#include <errno.h>
+#include <io/kbd_event.h>
+#include <io/pos_event.h>
+#include <types/ui/wdecor.h>
+
+struct ui_file_dialog;
+typedef struct ui_file_dialog ui_file_dialog_t;
+
+/** File dialog parameters */
+typedef struct {
+	/** Window caption */
+	const char *caption;
+} ui_file_dialog_params_t;
+
+/** File dialog callback */
+typedef struct ui_file_dialog_cb {
+	/** OK button was pressed */
+	void (*bok)(ui_file_dialog_t *, void *, const char *);
+	/** Cancel button was pressed */
+	void (*bcancel)(ui_file_dialog_t *, void *);
+	/** Window closure requested (e.g. via close button) */
+	void (*close)(ui_file_dialog_t *, void *);
+} ui_file_dialog_cb_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ui/include/ui/entry.h
===================================================================
--- uspace/lib/ui/include/ui/entry.h	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/include/ui/entry.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -52,4 +52,5 @@
 extern void ui_entry_set_read_only(ui_entry_t *, bool);
 extern errno_t ui_entry_set_text(ui_entry_t *, const char *);
+extern const char *ui_entry_get_text(ui_entry_t *);
 extern errno_t ui_entry_paint(ui_entry_t *);
 extern void ui_entry_backspace(ui_entry_t *);
Index: uspace/lib/ui/include/ui/filedialog.h
===================================================================
--- uspace/lib/ui/include/ui/filedialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
+++ uspace/lib/ui/include/ui/filedialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2021 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libui
+ * @{
+ */
+/**
+ * @file File dialog
+ */
+
+#ifndef _UI_FILEDIALOG_H
+#define _UI_FILEDIALOG_H
+
+#include <errno.h>
+#include <types/ui/filedialog.h>
+#include <types/ui/ui.h>
+
+extern void ui_file_dialog_params_init(ui_file_dialog_params_t *);
+extern errno_t ui_file_dialog_create(ui_t *, ui_file_dialog_params_t *,
+    ui_file_dialog_t **);
+extern void ui_file_dialog_set_cb(ui_file_dialog_t *, ui_file_dialog_cb_t *,
+    void *);
+extern void ui_file_dialog_destroy(ui_file_dialog_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ui/include/ui/msgdialog.h
===================================================================
--- uspace/lib/ui/include/ui/msgdialog.h	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/include/ui/msgdialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -31,9 +31,9 @@
  */
 /**
- * @file Message Dialog
+ * @file Message dialog
  */
 
-#ifndef _UI_MSG_DIALOG_H
-#define _UI_MSG_DIALOG_H
+#ifndef _UI_MSGDIALOG_H
+#define _UI_MSGDIALOG_H
 
 #include <errno.h>
Index: uspace/lib/ui/meson.build
===================================================================
--- uspace/lib/ui/meson.build	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/meson.build	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -33,4 +33,5 @@
 	'src/dummygc.c',
 	'src/entry.c',
+	'src/filedialog.c',
 	'src/fixed.c',
 	'src/image.c',
@@ -55,4 +56,5 @@
 	'test/control.c',
 	'test/entry.c',
+	'test/filedialog.c',
 	'test/fixed.c',
 	'test/image.c',
Index: uspace/lib/ui/private/filedialog.h
===================================================================
--- uspace/lib/ui/private/filedialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
+++ uspace/lib/ui/private/filedialog.h	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2021 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libui
+ * @{
+ */
+/**
+ * @file File dialog structure
+ *
+ */
+
+#ifndef _UI_PRIVATE_FILEDIALOG_H
+#define _UI_PRIVATE_FILEDIALOG_H
+
+/** Actual structure of file dialog.
+ *
+ * This is private to libui.
+ */
+struct ui_file_dialog {
+	/** Dialog window */
+	struct ui_window *window;
+	/** File name entry */
+	struct ui_entry *ename;
+	/** OK button */
+	struct ui_pbutton *bok;
+	/** Cancel button */
+	struct ui_pbutton *bcancel;
+	/** File dialog callbacks */
+	struct ui_file_dialog_cb *cb;
+	/** Callback argument */
+	void *arg;
+};
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ui/src/entry.c
===================================================================
--- uspace/lib/ui/src/entry.c	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/src/entry.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -190,8 +190,18 @@
 	entry->pos = str_size(text);
 	entry->sel_start = entry->pos;
+
 	ui_entry_scroll_update(entry, false);
 	ui_entry_paint(entry);
 
 	return EOK;
+}
+
+/** Get entry text.
+ *
+ * @return Pointer to entry text.
+ */
+const char *ui_entry_get_text(ui_entry_t *entry)
+{
+	return entry->text;
 }
 
Index: uspace/lib/ui/src/filedialog.c
===================================================================
--- uspace/lib/ui/src/filedialog.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
+++ uspace/lib/ui/src/filedialog.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 2021 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libui
+ * @{
+ */
+/**
+ * @file File dialog
+ */
+
+#include <errno.h>
+#include <mem.h>
+#include <stdlib.h>
+#include <ui/entry.h>
+#include <ui/fixed.h>
+#include <ui/label.h>
+#include <ui/filedialog.h>
+#include <ui/pbutton.h>
+#include <ui/resource.h>
+#include <ui/ui.h>
+#include <ui/window.h>
+#include "../private/filedialog.h"
+
+static void ui_file_dialog_wnd_close(ui_window_t *, void *);
+
+ui_window_cb_t ui_file_dialog_wnd_cb = {
+	.close = ui_file_dialog_wnd_close
+};
+
+static void ui_file_dialog_bok_clicked(ui_pbutton_t *, void *);
+static void ui_file_dialog_bcancel_clicked(ui_pbutton_t *, void *);
+
+ui_pbutton_cb_t ui_file_dialog_bok_cb = {
+	.clicked = ui_file_dialog_bok_clicked
+};
+
+ui_pbutton_cb_t ui_file_dialog_bcancel_cb = {
+	.clicked = ui_file_dialog_bcancel_clicked
+};
+
+/** Initialize file dialog parameters structure.
+ *
+ * File dialog parameters structure must always be initialized using
+ * this function first.
+ *
+ * @param params File dialog parameters structure
+ */
+void ui_file_dialog_params_init(ui_file_dialog_params_t *params)
+{
+	memset(params, 0, sizeof(ui_file_dialog_params_t));
+}
+
+/** Create new file dialog.
+ *
+ * @param ui User interface
+ * @param params File dialog parameters
+ * @param rdialog Place to store pointer to new dialog
+ * @return EOK on success or an error code
+ */
+errno_t ui_file_dialog_create(ui_t *ui, ui_file_dialog_params_t *params,
+    ui_file_dialog_t **rdialog)
+{
+	errno_t rc;
+	ui_file_dialog_t *dialog;
+	ui_window_t *window = NULL;
+	ui_wnd_params_t wparams;
+	ui_fixed_t *fixed = NULL;
+	ui_label_t *label = NULL;
+	ui_entry_t *entry = NULL;
+	ui_pbutton_t *bok = NULL;
+	ui_pbutton_t *bcancel = NULL;
+	gfx_rect_t rect;
+	ui_resource_t *ui_res;
+
+	dialog = calloc(1, sizeof(ui_file_dialog_t));
+	if (dialog == NULL) {
+		rc = ENOMEM;
+		goto error;
+	}
+
+	ui_wnd_params_init(&wparams);
+	wparams.caption = params->caption;
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		wparams.rect.p0.x = 0;
+		wparams.rect.p0.y = 0;
+		wparams.rect.p1.x = 40;
+		wparams.rect.p1.y = 10;
+	} else {
+		wparams.rect.p0.x = 0;
+		wparams.rect.p0.y = 0;
+		wparams.rect.p1.x = 300;
+		wparams.rect.p1.y = 135;
+	}
+
+	rc = ui_window_create(ui, &wparams, &window);
+	if (rc != EOK)
+		goto error;
+
+	ui_window_set_cb(window, &ui_file_dialog_wnd_cb, dialog);
+
+	ui_res = ui_window_get_res(window);
+
+	rc = ui_fixed_create(&fixed);
+	if (rc != EOK)
+		goto error;
+
+	rc = ui_label_create(ui_res, "File Name:", &label);
+	if (rc != EOK)
+		goto error;
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		rect.p0.x = 3;
+		rect.p0.y = 3;
+		rect.p1.x = 17;
+		rect.p1.y = 4;
+	} else {
+		rect.p0.x = 10;
+		rect.p0.y = 35;
+		rect.p1.x = 190;
+		rect.p1.y = 50;
+	}
+
+	ui_label_set_rect(label, &rect);
+
+	rc = ui_fixed_add(fixed, ui_label_ctl(label));
+	if (rc != EOK)
+		goto error;
+
+	label = NULL;
+
+	rc = ui_entry_create(window, "", &entry);
+	if (rc != EOK)
+		goto error;
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		rect.p0.x = 3;
+		rect.p0.y = 5;
+		rect.p1.x = 37;
+		rect.p1.y = 6;
+	} else {
+		rect.p0.x = 10;
+		rect.p0.y = 55;
+		rect.p1.x = 290;
+		rect.p1.y = 80;
+	}
+
+	ui_entry_set_rect(entry, &rect);
+
+	rc = ui_fixed_add(fixed, ui_entry_ctl(entry));
+	if (rc != EOK)
+		goto error;
+
+	dialog->ename = entry;
+	entry = NULL;
+
+	rc = ui_pbutton_create(ui_res, "OK", &bok);
+	if (rc != EOK)
+		goto error;
+
+	ui_pbutton_set_cb(bok, &ui_file_dialog_bok_cb, dialog);
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		rect.p0.x = 10;
+		rect.p0.y = 7;
+		rect.p1.x = 20;
+		rect.p1.y = 8;
+	} else {
+		rect.p0.x = 55;
+		rect.p0.y = 90;
+		rect.p1.x = 145;
+		rect.p1.y = 118;
+	}
+
+	ui_pbutton_set_rect(bok, &rect);
+
+	ui_pbutton_set_default(bok, true);
+
+	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bok));
+	if (rc != EOK)
+		goto error;
+
+	dialog->bok = bok;
+	bok = NULL;
+
+	rc = ui_pbutton_create(ui_res, "Cancel", &bcancel);
+	if (rc != EOK)
+		goto error;
+
+	ui_pbutton_set_cb(bcancel, &ui_file_dialog_bcancel_cb, dialog);
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		rect.p0.x = 22;
+		rect.p0.y = 7;
+		rect.p1.x = 32;
+		rect.p1.y = 8;
+	} else {
+		rect.p0.x = 155;
+		rect.p0.y = 90;
+		rect.p1.x = 245;
+		rect.p1.y = 118;
+	}
+
+	ui_pbutton_set_rect(bcancel, &rect);
+
+	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bcancel));
+	if (rc != EOK)
+		goto error;
+
+	dialog->bcancel = bcancel;
+	bcancel = NULL;
+
+	ui_window_add(window, ui_fixed_ctl(fixed));
+	fixed = NULL;
+
+	rc = ui_window_paint(window);
+	if (rc != EOK)
+		goto error;
+
+	dialog->window = window;
+	*rdialog = dialog;
+	return EOK;
+error:
+	if (entry != NULL)
+		ui_entry_destroy(entry);
+	if (bok != NULL)
+		ui_pbutton_destroy(bok);
+	if (bcancel != NULL)
+		ui_pbutton_destroy(bcancel);
+	if (label != NULL)
+		ui_label_destroy(label);
+	if (fixed != NULL)
+		ui_fixed_destroy(fixed);
+	if (window != NULL)
+		ui_window_destroy(window);
+	if (dialog != NULL)
+		free(dialog);
+	return rc;
+}
+
+/** Destroy file dialog.
+ *
+ * @param dialog File dialog or @c NULL
+ */
+void ui_file_dialog_destroy(ui_file_dialog_t *dialog)
+{
+	if (dialog == NULL)
+		return;
+
+	ui_window_destroy(dialog->window);
+	free(dialog);
+}
+
+/** Set mesage dialog callback.
+ *
+ * @param dialog File dialog
+ * @param cb File dialog callbacks
+ * @param arg Callback argument
+ */
+void ui_file_dialog_set_cb(ui_file_dialog_t *dialog, ui_file_dialog_cb_t *cb,
+    void *arg)
+{
+	dialog->cb = cb;
+	dialog->arg = arg;
+}
+
+/** File dialog window close handler.
+ *
+ * @param window Window
+ * @param arg Argument (ui_file_dialog_t *)
+ */
+static void ui_file_dialog_wnd_close(ui_window_t *window, void *arg)
+{
+	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
+
+	if (dialog->cb != NULL && dialog->cb->close != NULL)
+		dialog->cb->close(dialog, dialog->arg);
+}
+
+/** File dialog OK button click handler.
+ *
+ * @param pbutton Push button
+ * @param arg Argument (ui_file_dialog_t *)
+ */
+static void ui_file_dialog_bok_clicked(ui_pbutton_t *pbutton, void *arg)
+{
+	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
+	const char *fname;
+
+	if (dialog->cb != NULL && dialog->cb->bok != NULL) {
+		fname = ui_entry_get_text(dialog->ename);
+		dialog->cb->bok(dialog, dialog->arg, fname);
+	}
+}
+
+/** File dialog cancel button click handler.
+ *
+ * @param pbutton Push button
+ * @param arg Argument (ui_file_dialog_t *)
+ */
+static void ui_file_dialog_bcancel_clicked(ui_pbutton_t *pbutton, void *arg)
+{
+	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
+
+	if (dialog->cb != NULL && dialog->cb->bcancel != NULL)
+		dialog->cb->bcancel(dialog, dialog->arg);
+}
+
+/** @}
+ */
Index: uspace/lib/ui/src/msgdialog.c
===================================================================
--- uspace/lib/ui/src/msgdialog.c	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/src/msgdialog.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -177,4 +177,5 @@
 		goto error;
 
+	dialog->bok = bok;
 	bok = NULL;
 
@@ -187,8 +188,9 @@
 
 	dialog->window = window;
-	dialog->bok = bok;
 	*rdialog = dialog;
 	return EOK;
 error:
+	if (bok != NULL)
+		ui_pbutton_destroy(bok);
 	if (label != NULL)
 		ui_label_destroy(label);
Index: uspace/lib/ui/test/filedialog.c
===================================================================
--- uspace/lib/ui/test/filedialog.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
+++ uspace/lib/ui/test/filedialog.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2021 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <pcut/pcut.h>
+#include <stdbool.h>
+#include <ui/pbutton.h>
+#include <ui/ui.h>
+#include <ui/filedialog.h>
+#include "../private/filedialog.h"
+#include "../private/window.h"
+
+PCUT_INIT;
+
+PCUT_TEST_SUITE(file_dialog);
+
+static void test_dialog_bok(ui_file_dialog_t *, void *, const char *);
+static void test_dialog_bcancel(ui_file_dialog_t *, void *);
+static void test_dialog_close(ui_file_dialog_t *, void *);
+
+static ui_file_dialog_cb_t test_file_dialog_cb = {
+	.bok = test_dialog_bok,
+	.bcancel = test_dialog_bcancel,
+	.close = test_dialog_close
+};
+
+static ui_file_dialog_cb_t dummy_file_dialog_cb = {
+};
+
+typedef struct {
+	bool bok;
+	const char *fname;
+	bool bcancel;
+	bool close;
+} test_cb_resp_t;
+
+/** Create and destroy file dialog */
+PCUT_TEST(create_destroy)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_file_dialog_params_t params;
+	ui_file_dialog_t *dialog = NULL;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_file_dialog_params_init(&params);
+	params.caption = "Open";
+
+	rc = ui_file_dialog_create(ui, &params, &dialog);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(dialog);
+
+	ui_file_dialog_destroy(dialog);
+	ui_destroy(ui);
+}
+
+/** ui_file_dialog_destroy() can take NULL argument (no-op) */
+PCUT_TEST(destroy_null)
+{
+	ui_file_dialog_destroy(NULL);
+}
+
+/** Button click invokes callback set via ui_file_dialog_set_cb() */
+PCUT_TEST(button_cb)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_file_dialog_params_t params;
+	ui_file_dialog_t *dialog = NULL;
+	test_cb_resp_t resp;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_file_dialog_params_init(&params);
+	params.caption = "Open";
+
+	rc = ui_file_dialog_create(ui, &params, &dialog);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(dialog);
+
+	/* OK button callback with no callbacks set */
+	ui_pbutton_clicked(dialog->bok);
+
+	/* OK button callback with callback not implemented */
+	ui_file_dialog_set_cb(dialog, &dummy_file_dialog_cb, NULL);
+	ui_pbutton_clicked(dialog->bok);
+
+	/* OK button callback with real callback set */
+	resp.bok = false;
+	ui_file_dialog_set_cb(dialog, &test_file_dialog_cb, &resp);
+	ui_pbutton_clicked(dialog->bok);
+	PCUT_ASSERT_TRUE(resp.bok);
+
+	ui_file_dialog_destroy(dialog);
+	ui_destroy(ui);
+}
+
+/** Sending window close request invokes callback set via
+ * ui_file_dialog_set_cb()
+ */
+PCUT_TEST(close_cb)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_file_dialog_params_t params;
+	ui_file_dialog_t *dialog = NULL;
+	test_cb_resp_t resp;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_file_dialog_params_init(&params);
+	params.caption = "Open";
+
+	rc = ui_file_dialog_create(ui, &params, &dialog);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(dialog);
+
+	/* Button callback with no callbacks set */
+	ui_window_send_close(dialog->window);
+
+	/* Button callback with unfocus callback not implemented */
+	ui_file_dialog_set_cb(dialog, &dummy_file_dialog_cb, NULL);
+	ui_window_send_close(dialog->window);
+
+	/* Button callback with real callback set */
+	resp.close = false;
+	ui_file_dialog_set_cb(dialog, &test_file_dialog_cb, &resp);
+	ui_window_send_close(dialog->window);
+	PCUT_ASSERT_TRUE(resp.close);
+
+	ui_file_dialog_destroy(dialog);
+	ui_destroy(ui);
+}
+
+static void test_dialog_bok(ui_file_dialog_t *dialog, void *arg,
+    const char *fname)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->bok = true;
+}
+
+static void test_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->bcancel = true;
+}
+
+static void test_dialog_close(ui_file_dialog_t *dialog, void *arg)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->close = true;
+}
+
+PCUT_EXPORT(file_dialog);
Index: uspace/lib/ui/test/main.c
===================================================================
--- uspace/lib/ui/test/main.c	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/test/main.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -34,4 +34,5 @@
 PCUT_IMPORT(checkbox);
 PCUT_IMPORT(entry);
+PCUT_IMPORT(file_dialog);
 PCUT_IMPORT(fixed);
 PCUT_IMPORT(image);
@@ -40,4 +41,5 @@
 PCUT_IMPORT(menubar);
 PCUT_IMPORT(menuentry);
+PCUT_IMPORT(msg_dialog);
 PCUT_IMPORT(paint);
 PCUT_IMPORT(pbutton);
Index: uspace/lib/ui/test/msgdialog.c
===================================================================
--- uspace/lib/ui/test/msgdialog.c	(revision edeee9ff19d63d97e85f6ecbd93e661f2b5ff66d)
+++ uspace/lib/ui/test/msgdialog.c	(revision 5e109e1dede8ff8cce30393b718b30ae302b32b1)
@@ -108,5 +108,5 @@
 	ui_pbutton_clicked(dialog->bok);
 
-	/* Button callback with unfocus callback not implemented */
+	/* Button callback with callback not implemented */
 	ui_msg_dialog_set_cb(dialog, &dummy_msg_dialog_cb, NULL);
 	ui_pbutton_clicked(dialog->bok);
