Guidance for creating Blazor components that emulate ASP.NET Web Forms controls. Use this when implementing new components or extending existing ones in the BlazorWebFormsComponents library.
79
73%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./.github/skills/component-development/SKILL.mdThis skill covers creating new Blazor components that emulate ASP.NET Web Forms controls.
System.Web.UI.WebControlssrc/BlazorWebFormsComponents/{ComponentName}.razorsrc/BlazorWebFormsComponents/{ComponentName}.razor.csBaseWebFormsComponent - Basic componentsBaseStyledComponent - Components with stylingDataBoundComponent<T> - Data-bound componentssrc/BlazorWebFormsComponents.Test/{ComponentName}/samples/AfterBlazorServerSide/Components/Pages/ControlSamples/{ComponentName}/samples/AfterBlazorServerSide.Tests/docs/{Category}/{ComponentName}.mdsamples/AfterBlazorServerSide/Components/Layout/NavMenu.razor (TreeView)samples/AfterBlazorServerSide/Components/Pages/ComponentList.razor (home page catalog)mkdocs.yml and README.md| Base Class | Use When |
|---|---|
BaseWebFormsComponent | Simple components without styling (Literal, PlaceHolder) |
BaseStyledComponent | Components with visual styling (Label, Panel, Button) |
ButtonBaseComponent | Button-like components (Button, LinkButton, ImageButton) |
DataBoundComponent<T> | Components binding to collections (Repeater, GridView) |
BaseValidator | Validation controls |
Match Web Forms property names exactly:
Text not Label or ContentCssClass not Class or ClassNameNavigateUrl not Href or UrlImageUrl not Src or SourcePrefix with On:
OnClick for click eventsOnCommand for command eventsOnSelectedIndexChanged for selection changesOnDataBinding for data binding eventsEvery component must have integration tests in samples/AfterBlazorServerSide.Tests/ using Playwright:
Page load test in ControlSampleTests.cs:
[Theory] test (EditorControl, DataControl, etc.)Interactive test in InteractiveComponentTests.cs (for interactive components):
Example page load test entry:
[Theory]
[InlineData("/ControlSamples/YourComponent")]
public async Task EditorControl_Loads_WithoutErrors(string path)Example interactive test:
[Fact]
public async Task YourComponent_Interaction_Works()
{
var page = await _fixture.NewPageAsync();
try
{
await page.GotoAsync($"{_fixture.BaseUrl}/ControlSamples/YourComponent");
// Test interactions...
// Assert expected behavior...
}
finally
{
await page.CloseAsync();
}
}Run integration tests with:
dotnet test samples/AfterBlazorServerSide.Tests9bf8669
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.