39 lines
1.4 KiB
Plaintext
39 lines
1.4 KiB
Plaintext
@inherits DComponentBase
|
|||
|
|
|
||
|
|
@* daisyUI File input: https://daisyui.com/components/file-input/ . Blazor's InputFile with the file-input classes;
|
||
|
|
read the files in OnChange (e.File / e.GetMultipleFiles()). *@
|
||
|
|
<InputFile @attributes="AdditionalAttributes" class="@CssClass" OnChange="OnChange" multiple="@Multiple" accept="@Accept" />
|
||
|
|
|
||
|
|
@code {
|
||
|
|
[Parameter] public EventCallback<InputFileChangeEventArgs> OnChange { get; set; }
|
||
|
|
[Parameter] public bool Multiple { get; set; }
|
||
|
|
/// <summary>The accept attribute: file types, e.g. "image/*,.pdf".</summary>
|
||
|
|
[Parameter] public string Accept { get; set; }
|
||
|
|
[Parameter] public DColor Color { get; set; }
|
||
|
|
[Parameter] public DSize Size { get; set; }
|
||
|
|
[Parameter] public bool Ghost { get; set; }
|
||
|
|
|
||
|
|
string CssClass => Cx("file-input", ColorClass, SizeClass, Ghost ? "file-input-ghost" : null, Class);
|
||
|
|
|
||
|
|
string ColorClass => Color switch
|
||
|
|
{
|
||
|
|
DColor.Neutral => "file-input-neutral",
|
||
|
|
DColor.Primary => "file-input-primary",
|
||
|
|
DColor.Secondary => "file-input-secondary",
|
||
|
|
DColor.Accent => "file-input-accent",
|
||
|
|
DColor.Info => "file-input-info",
|
||
|
|
DColor.Success => "file-input-success",
|
||
|
|
DColor.Warning => "file-input-warning",
|
||
|
|
DColor.Error => "file-input-error",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
|
||
|
|
string SizeClass => Size switch
|
||
|
|
{
|
||
|
|
DSize.Xs => "file-input-xs",
|
||
|
|
DSize.Sm => "file-input-sm",
|
||
|
|
DSize.Lg => "file-input-lg",
|
||
|
|
DSize.Xl => "file-input-xl",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
}
|