This project shows how to add a dynamic style to a component that allows a user of the component to set the styling.
Components are the basic part of Blazor and to provide good UI components it is required that to let the user of the component be able to change the styling to fit there application without needing to have access to the code.
-
Clone this repository
git clone https://github.com/CodingWithDavid/DateTimeComponent cd DateTimeComponent
-
Open in Visual Studio or Visual Code a. With Visual Code you will need to install the C# extensions
-
Press F5
I am using the basic Server side Blazor template but the code is the same wither it is Server side or client side.
- Displaying Date time in a format
- Using a timer
- Making a component
- Adding parameters to the component
- Setting a CSS class in HTML with a variable
- Passing in a CSS class to set a style dynamically
- Using a inner class CSS selector to target styles of the inner HTML