SharpStyles 0.4.0
See the version list below for details.
dotnet add package SharpStyles --version 0.4.0
NuGet\Install-Package SharpStyles -Version 0.4.0
<PackageReference Include="SharpStyles" Version="0.4.0" />
paket add SharpStyles --version 0.4.0
#r "nuget: SharpStyles, 0.4.0"
// Install SharpStyles as a Cake Addin #addin nuget:?package=SharpStyles&version=0.4.0 // Install SharpStyles as a Cake Tool #tool nuget:?package=SharpStyles&version=0.4.0
<p align="center"> <img width="25%" height="25%" src="https://raw.githubusercontent.com/hassanhabib/SharpStyles/master/SharpStyles/Resources/SharpStyles.png"> </p>
SharpStyles
TDD-able Styles for Blazor
This library offers the capability to write CSS rules in C#. This capability allows C#.NET developers especially for Blazor applications to test-drive the CSS rules in their components effectively.
How to Use
To use SharpStyles; all you need to do is to inherit the SharpStyles
model to your local Component Style models as follows:
Setup
public class MyComponentStyle: SharpStyle
{
[CssElement]
public SharpStyle Td {get; set;}
[CssClass]
public SharpStyle PrimaryButton {get; set;}
[CssId]
public SharpStyle SubmitButton {get; set;}
}
Now you can use MyComponentStyle
as follows:
var myComponentStyle = new MyComponentStyle
{
Td = new SharpStyle
{
BackgroundColor = "red"
},
PrimaryButton = new SharpStyle
{
BackgroundColor = "blue",
Color = "white"
},
SubmitButton = new SharpStyle
{
Width = "12px"
}
}
You can now use this object myComponentStyle
to generate CSS rules for your Blazor component just as follows:
myComponentStyle.ToCss();
This code will generate the following rules:
td {
background-color: "red";
}
.primary-button {
background-color: "blue";
color: "white";
}
#submit-button {
width: "12px";
}
You can also customize your selectors as follows:
public class MyComponentStyle: SharpStyle
{
[CssElement(Selector="my-custom-td")]
public SharpStyle Td {get; set;}
[CssClass(Selector=".my-custom-primary-button")]
public SharpStyle PrimaryButton {get; set;}
[CssId(Selector="#my-custom-submit-button")]
public SharpStyle SubmitButton {get; set;}
}
which will produce the following CSS:
my-custom-td {
background-color: "red";
}
.my-custom-primary-button {
background-color: "blue";
color: "white";
}
#my-custom-submit-button {
width: "12px";
}
here's a video introduction to this library:
<br />
If you have any suggestions, comments or questions, please feel free to contact me on: <br /> Twitter: @hassanrezkhabib <br /> LinkedIn: hassanrezkhabib <br /> E-Mail: hassanhabib@live.com <br />
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial Release