Skip to content

Add FileInput and DragAndDropFileInput components with documentation#1293

Merged
gvreddy04 merged 13 commits into
mainfrom
features/1044-new-file-input-component
Jul 13, 2026
Merged

Add FileInput and DragAndDropFileInput components with documentation#1293
gvreddy04 merged 13 commits into
mainfrom
features/1044-new-file-input-component

Conversation

@gvreddy04

Copy link
Copy Markdown
Contributor

This pull request adds new demos and documentation for the FileInput and DragAndDropFileInput components, integrating them into the navigation, home page, and documentation sections of the Blazor Bootstrap demo application. The changes introduce comprehensive usage examples, validation scenarios, and form integration for both components.

Navigation and Home Page Integration:

  • Added File Input and Drag and Drop File Input navigation items to the main, demos, and docs layouts, making these demos easily accessible from the sidebar menus.
  • Featured Drag and Drop File Input as a new component on the home page with a "New" badge.

Demos for File Input Components:

  • Added demo pages for FileInput, covering basic usage, multiple file selection and removal, different sizes, validation, form validation, and unrestricted extension scenarios.
  • Added demo pages for DragAndDropFileInput, including basic usage, validation, and form validation, with code examples for each scenario.

Documentation Updates:

  • Added documentation pages for both FileInput and DragAndDropFileInput, including parameter and event tables, and cross-links to the corresponding demos.

These changes provide users with clear guidance and interactive examples for using the new file input components in forms, including validation and integration with Blazor's form model.

gvreddy04 added 11 commits July 12, 2026 11:37
Introduced a new FileInput component to the Blazor Bootstrap library, supporting file selection via click or drag-and-drop.

- Added validation for file size, count, and extensions.
- Enabled multiple file selection and hint text display.
- Styled the component with CSS for drop zones and file lists.
- Updated navigation menus and routing constants for the new demo.
- Created demo pages showcasing various FileInput features.
- Added documentation detailing parameters and events.
Added `file-input.mdx` to document the Blazor Bootstrap `FileInput` component. Included metadata, parameters, events, and accessibility details. Provided usage examples for drag-and-drop, validation, multiple file selection, and styling. Linked to relevant demos for better understanding.
Refactored `FileInput` to separate drag-and-drop functionality into a new `DragAndDropFileInput` component. Introduced `FileInputBase` to centralize shared logic and properties. Simplified `FileInput.razor` to focus on basic file input handling. Added drag-and-drop-specific logic and styles to `DragAndDropFileInput.razor` and `DragAndDropFileInput.razor.css`. Enhanced accessibility with ARIA attributes and improved maintainability by separating concerns between components.
Introduced a new `DragAndDropFileInput` component to support drag-and-drop file selection and touch file-picker functionality.

- Updated layouts to include `DragAndDropFileInput` in navigation.
- Added routes for the new component in `DemoRouteConstants` and `DocsRouteConstants`.
- Created documentation and demos for `DragAndDropFileInput`.
- Refined `FileInput` to focus on standard Bootstrap file control.
- Removed `BackgroundColor` from `FileInputBase` and added it to `DragAndDropFileInput`.
- Updated `Index.razor` to link to new demos.
Added a "Form validation" section to `DragAndDropFileInputDocumentation.razor` and `FileInputDocumentation.razor` to demonstrate `FilesChanged` usage. Introduced a `Size` parameter in `FileInput.razor.cs` and removed it from `FileInputBase.cs` for better encapsulation. Updated `DragAndDropFileInput.razor.css` to use `::deep` for proper CSS scoping.

Refined `file-input.mdx` and created `drag-and-drop-file-input.mdx` to enhance documentation with examples, parameters, and accessibility details. Added new form validation examples in `DragAndDropFileInput_Demo_03_Form_Validation.razor` and `FileInput_Demo_06_Form_Validation.razor`. Improved accessibility and clarified usage of `DragAndDropFileInput`.
Removed unused `using` directives from `DragAndDropFileInput.razor.cs`, `FileInput.razor.cs`, and `FileInputBase.cs` to improve code maintainability and reduce unnecessary dependencies.
Replaced custom classes in FileInput.razor with Bootstrap
classes for `<ul>` and `<li>` elements to improve styling
consistency. Removed unused CSS styles for `.bb-file-input__files`
and `.bb-file-input__file` from FileInput.razor.css.
Replaced custom classes with Bootstrap classes for styling in
`DragAndDropFileInput.razor` and `FileInput.razor`. Updated `ul`
and `li` elements to use `list-group` classes. Replaced validation
error `div` with `text-danger`. Removed unused CSS styles.
Replaced hardcoded validation messages with customizable templates and tokens.
Added private constants for default message templates and a helper method
`FormatValidationMessage` for dynamic message generation. Updated methods
to use the new templates, improving maintainability and flexibility.
Enhanced `DragAndDropFileInput` and `FileInput` components with new properties for customizable validation messages. Updated documentation and examples to demonstrate usage of tokens like `{FileName}`, `{MaxFileSize}`, `{AllowedFileTypes}`, and `{MaxFileCount}`. Improved user feedback for file type, size, and count validations.
Added a "Drag and Drop File Input" section with a link to
`@DemoRouteConstants.Demos_URL_DragAndDropFileInput`, including
an icon and a "New" badge.

Added a "File Input" section with a link to
`@DemoRouteConstants.Demos_URL_FileInput`, also including an
icon and a "New" badge.
@gvreddy04 gvreddy04 added this to the 4.0.0 milestone Jul 13, 2026
@gvreddy04 gvreddy04 self-assigned this Jul 13, 2026
Centralized validation styles into `blazor.bootstrap.css` using new CSS variables for outlines and messages. Removed inline styles from `.razor` files and replaced them with the new centralized classes.

Updated `SortableList.razor` to use a new class `sortable-list-group-item` for better styling control. Adjusted related templates and CSS to reflect this change.
Replaced hardcoded validation color values with dynamic `rgba`
values based on Bootstrap's `--bs-success-rgb`, `--bs-danger-rgb`,
and the new `--bs-text-opacity` variable. This enhances
consistency and supports easier theme customization.
@gvreddy04 gvreddy04 merged commit 5bd30c2 into main Jul 13, 2026
1 of 3 checks passed
@gvreddy04 gvreddy04 deleted the features/1044-new-file-input-component branch July 13, 2026 07:27
@gvreddy04 gvreddy04 linked an issue Jul 13, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement FileInput Component

1 participant