Skip to content

Inputs

FileInput

Bit.BlazorUI

BitFileInput lets the user hand files to the app - through the file dialog, by dropping them onto it or by pasting them - without uploading anything. Each file surfaces in C# as a BitFileInputInfo (name, size, type, folder and, on request, image dimensions) and is validated on arrival against size, total size, type, count, duplicate and custom rules; a rejected file stays in the list with its reason. Content is read on demand, as a byte array or a stream. A drop zone panel, thumbnails, type glyphs, remove buttons, templates and screen reader announcements are built in. To send files to a server, use BitFileUpload.

Customization

The variants of the browse button, defaults through BitParams, colors, external icons, sizes, Style & Class with the CSS variables, and right-to-left layouts.

Variant

Variant sets how much of the Color the browse button carries: Fill (the default), Outline or Text. All three fill in on hover and turn into the same dashed drop indicator.



Disabled:



Variant & Color:

Cascading parameters

BitParams hands a BitFileInputParams to every file input under it. Its values are defaults, not overrides: an input keeps each parameter it sets itself.

Anything up to 1 MB. Drop it here or browse.
Anything up to 1 MB. Drop it here or browse.

Color

Color sets the theme color of the browse button, its focus ring and the drop indicator (Primary by default).





External Icons

RemoveButtonIcon, and whatever FileIconSelector returns, accept any icon library through BitIconInfo.Fa(), BitIconInfo.Bi() or BitIconInfo.Css().


FontAwesome:







Bootstrap:



Size

Size scales the browse button, the file items, their thumbnails and their remove buttons together.

Small:



Medium:



Large:

Style & Class

Style and Class target the root, Styles and Classes each part. Their Dragging entry applies to the root only while files hover over it.


Component's Style & Class:





Styles & Classes:





The public CSS variables inherit, so they can be set on :root, on an ancestor or on the Style of one instance. They restyle the default, not a choice: an explicit Color or Size wins over the variables for what it sets.

CSS variables:


Set once on an ancestor, inherited by every file input inside it:

RTL

Setting Dir to BitDir.Rtl mirrors the whole layout.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.