diff --git a/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx b/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx
index 156c1acca75..833734fad02 100644
--- a/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx
+++ b/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx
@@ -30,7 +30,7 @@ describe('FileUpload', () => {
const testFileName = 'grafana.png';
const file = new File(['(⌐□_□)'], testFileName, { type: 'image/png' });
const onFileUpload = jest.fn();
- const { getByTestId } = render();
+ const { getByTestId } = render();
let uploader = getByTestId(selectors.components.FileUpload.inputField);
await waitFor(() =>
fireEvent.change(uploader, {
@@ -45,7 +45,7 @@ describe('FileUpload', () => {
const testFileName = 'longFileName.something.png';
const file = new File(['(⌐□_□)'], testFileName, { type: 'image/png' });
const onFileUpload = jest.fn();
- const { getByTestId } = render();
+ const { getByTestId } = render();
let uploader = getByTestId(selectors.components.FileUpload.inputField);
await waitFor(() =>
fireEvent.change(uploader, {
diff --git a/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx b/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx
index 12f05c59e11..514a8a233fb 100644
--- a/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx
+++ b/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx
@@ -31,6 +31,7 @@ export const FileUpload = ({
children = 'Upload file',
accept = '*',
size = 'md',
+ showFileName,
}: React.PropsWithChildren) => {
const style = useStyles2(getStyles(size));
const [fileName, setFileName] = useState('');
@@ -63,7 +64,7 @@ export const FileUpload = ({
{children}
- {fileName && (
+ {showFileName && fileName && (