UI: add placeholder to fileInput

This commit is contained in:
Johannes Kirschbauer
2024-08-21 15:23:41 +02:00
parent 9a222d62a7
commit b5951146bc

View File

@@ -16,6 +16,7 @@ interface FileInputProps {
label?: string; label?: string;
error?: string; error?: string;
helperText?: string; helperText?: string;
placeholder?: JSX.Element;
} }
/** /**
@@ -30,6 +31,7 @@ export function FileInput(props: FileInputProps) {
"value", "value",
"label", "label",
"error", "error",
"placeholder",
]); ]);
// Create file list // Create file list
@@ -68,7 +70,11 @@ export function FileInput(props: FileInputProps) {
> >
<Show <Show
when={getFiles().length} when={getFiles().length}
fallback={<>Click to select file{props.multiple && "s"}</>} fallback={
props.placeholder || (
<>Click to select file{props.multiple && "s"}</>
)
}
> >
Selected file{props.multiple && "s"}:{" "} Selected file{props.multiple && "s"}:{" "}
{getFiles() {getFiles()