A .NET 10 Blazor Server application demonstrating modern UI components built with HTML and CSS, featuring minimal JavaScript usage. This project showcases reusable UI controls that can be integrated into any Blazor component library.
This application demonstrates 6 core UI components that leverage native HTML and CSS capabilities:
- Dialog - Modal dialogs with overlay
- DropDown - Custom dropdown menus
- Accordion - Collapsible content sections
- Toast - Notification messages
- Popover - Contextual tooltips and popovers
- Add Employee - Generic entity dialog component with form validation
- .NET 10 - Latest .NET framework
- Blazor Server - Interactive server-side rendering
- C# 13.0 - Modern C# features
- Bootstrap 5 - Responsive styling
- HTML/CSS - Native web technologies (minimal JavaScript)
- .NET 10 SDK or later
- Visual Studio 2025 or later (recommended) or Visual Studio Code
- A modern web browser (Chrome, Edge, Firefox, Safari)
git clone <repository-url>
cd HTMLBlazor- Open
HTMLBlazor.slnin Visual Studio - Press
F5or click the "Run" button - The application will launch in your default browser
cd HTMLBlazor
dotnet restore
dotnet build
dotnet runThe application will be available at:
- HTTPS:
https://localhost:5001 - HTTP:
http://localhost:5000
HTMLBlazor/
??? Components/
? ??? Layout/
? ? ??? MainLayout.razor # Main layout component
? ? ??? NavMenu.razor # Navigation menu
? ? ??? ReconnectModal.razor # Blazor reconnection UI
? ??? Pages/
? ? ??? Home.razor # Landing page
? ? ??? Dialog.razor # Dialog component demo
? ? ??? DropDown.razor # Dropdown component demo
? ? ??? Accordion.razor # Accordion component demo
? ? ??? Toast.razor # Toast notification demo
? ? ??? Popover.razor # Popover component demo
? ? ??? AddEmployee.razor # Generic entity form demo
? ? ??? AddEntityDialog.razor # Reusable entity dialog
? ? ??? Error.razor # Error page
? ? ??? NotFound.razor # 404 page
? ??? App.razor # Root component
? ??? Routes.razor # Routing configuration
? ??? _Imports.razor # Global imports
??? Models/
? ??? Employee.cs # Employee data model
??? wwwroot/ # Static assets
??? Program.cs # Application entry point
??? HTMLBlazor.csproj # Project file
A modal dialog implementation with:
- Overlay background
- Click-outside-to-close functionality
- Stop propagation for dialog content
- Responsive design
A reusable form component featuring:
- Generic type parameter support (
TEntity) - Dynamic form generation based on model properties
- Callback for entity saved events
- Validation support
Demonstrates the generic dialog with:
- Employee data model
- Form input for multiple field types (text, email, date, number, boolean)
- Display table for saved employees
- Auto-incrementing ID assignment
The application uses different error handling based on the environment:
# Set environment variable for detailed errors
set ASPNETCORE_ENVIRONMENT=Development- Development: Detailed error information with request ID tracking
- Production: Custom error page at
/Error - 404 Errors: Custom not-found page at
/not-found
The application uses HSTS (HTTP Strict Transport Security) in production with a default of 30 days. Modify in Program.cs if needed.
The application uses:
- Bootstrap 5 for base styling
- Component-scoped CSS for individual component styles
- Isolated CSS files (e.g.,
Accordion.razor.css,Toast.razor.css)
- Responsive navigation menu with checkbox-based toggle
- Bootstrap icons integration
- NavLink with active state highlighting
- Page-based routing with
@pagedirectives - Status code handling (404 redirects)
- Exception handling with custom error pages
- Interactive Server render mode
- Real-time updates via SignalR
- Automatic reconnection handling
- Create a new
.razorfile inComponents/Pages/ - Add the
@pagedirective with route - Update
NavMenu.razorwith navigation link - Optionally create a scoped CSS file (
ComponentName.razor.css)
Add new data models in the Models/ folder and use them with the generic AddEntityDialog component.
- Chrome (latest)
- Edge (latest)
- Firefox (latest)
- Safari (latest)
[Add your license information here]
[Add contribution guidelines here]
[Add contact information here]
Note: This is a demonstration project showcasing HTML and CSS-based UI components with minimal JavaScript dependency, perfect for learning Blazor component development and creating reusable UI libraries.