syncfusion-blazor-toolkit-buttons
Provides implementation guidance for Blazor button components using Syncfusion Toolkit.
Install
mkdir -p .claude/skills/syncfusion-blazor-toolkit-buttons && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10720" && unzip -o skill.zip -d .claude/skills/syncfusion-blazor-toolkit-buttons && rm skill.zipInstalls to .claude/skills/syncfusion-blazor-toolkit-buttons
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Implement interactive Blazor button components with Syncfusion Toolkit. Covers SfButton, SfButtonGroup with styling and accessibility.Key capabilities
- →Implement SfButton
- →Implement SfButtonGroup
- →Handle button events
- →Apply accessibility standards
How it works
It provides component-specific implementation patterns for Syncfusion's Blazor button suite, including event handling and styling.
Inputs & outputs
When to use syncfusion-blazor-toolkit-buttons
- →Adding interactive buttons to Blazor
- →Implementing button groups
- →Styling components
- →Handling component accessibility
About this skill
Syncfusion Blazor Toolkit Buttons
✅ Render mode: Works in all render modes —
SfButtonis usable in Static SSR; only event handlers (OnClick) require interactivity. ReadAGENTS.mdto determine the project's interactivity mode before wiring event handlers.
Core Rules
SfButtondoes not render a<form>wrapper. Add<EditForm>or<form>yourself if you need form-scoped submission.IsPrimary="true"is presentational only. It applies the active-theme primary CSS class — pair with theme CSS to control actual visual weight.OnClickisEventCallback<MouseEventArgs>, fired after click; not cancellable. Use theCreatedlifecycle event for initialization, notOnClick.Disabledis one-way. The component does not auto-clear it after a click; toggle the bound flag manually in your@codeblock.IconCssaccepts a Syncfusion icon class pair (e.g.e-icons e-add). Bare-prefix classes won't render.SfButtonGroup Mode="SelectionMode.Multiple"allows empty selection. If you need mandatory selection, validate in code.- Inner
Buttoncomponents insideSfButtonGroupdo not inheritCssClass. Re-apply at the inner level. - Keyboard activation is
EnterandSpace. Don't override or you'll break accessibility. HtmlAttributescaptures arbitrary HTML attributes (id, data-*, role) without exposing every one as a property.
Don'ts
| Anti-pattern | Symptom | Fix |
|---|---|---|
async void OnClick = … | Exceptions silently escape the dispatcher; spinner "sticks" with no error | async Task OnClick(MouseEventArgs e) — let Blazor handle re-rendering |
<SfButton> inside <a> | Two interactive roles; click intercepted; ARIA mis-announcement | Use <SfButton> with CssClass="e-link" instead, or a true <a> |
Disabled="@(bool?)flag" | Nullable binding throws on toggle; component treats as always-false | Bind to a bool, never bool? |
Override :focus without :focus-visible replacement | WCAG 2.4.7 violation; keyboard users lose focus visibility | Define :focus-visible { outline: 2px solid var(--brand) } |
OnClick for form submit with no surrounding <EditForm> | Validation skipped; data posted without DataAnnotationsValidator | Wrap in <EditForm Model="…"><DataAnnotationsValidator/> then call OnValidSubmit |
Anti-Pattern Workflows
These are the four most common mistakes agents make; the workflow below each says exactly what to do instead.
Workflow 1 — Agent wants to wire OnClick="@Save"
Bad:
<SfButton OnClick="@Save">Save</SfButton>
@code { private async void Save(MouseEventArgs _) { /* ... */ } }
Why it fails: async void says "I will never await me" — Blazor's
dispatcher can't catch exceptions, so the unhappy path dumps to console.
Re-rendering also fights the awaited continuations.
This is a general Blazor rule across all click handlers (
SfButton,<button @onclick>, etc.) — see theauthor-componentupstream skill for the broader rule set.
Correct:
@using Syncfusion.Blazor.Toolkit.Buttons
<SfButton OnClick="@SaveAsync">Save</SfButton>
@code {
private bool _busy;
private async Task SaveAsync(MouseEventArgs _)
{
if (_busy) return;
_busy = true;
try { await SaveService.SaveAsync(model); }
finally { _busy = false; }
}
}
Workflow 2 — Agent nests SfButtonGroup inside <EditForm> expecting Disabled to clear
Bad:
<SfButtonGroup Mode="@SelectionMode.Multiple">
<Button>Bold</Button>
<Button>Italic</Button>
</SfButtonGroup>
Why it fails: empty selection is valid Multiple mode. Form-validation
won't catch "user selected nothing" unless you write a custom validator.
Correct:
@using Syncfusion.Blazor.Toolkit.Buttons
@using System.ComponentModel.DataAnnotations
<EditForm Model="editor">
<DataAnnotationsValidator/>
<ValidationMessage For="@(() => editor.Selection)"/>
<SfButtonGroup Mode="@SelectionMode.Multiple"
SelectedChanged="@SelectionChanged">
<Button>Bold</Button>
<Button>Italic</Button>
</SfButtonGroup>
</EditForm>
@code {
private void SelectionChanged(Syncfusion.Blazor.Toolkit.Buttons.SelectedItemsChangedEventArgs e)
{
editor.Selection = e.SelectedIndexes; // not empty after a click
}
public class EditorModel { [Required] public int[] Selection { get; set; } = Array.Empty<int>(); }
}
Workflow 3 — Agent places <SfButton> inside a <a> to make a card link
Bad:
<a href="/detail/42">
<SfButton Content="Open" OnClick="OpenDetail" /> <!-- both click handlers fire -->
</a>
Why it fails: clicking the button bubbles to the parent anchor and fires two navigations. ARIA reports two controls on one element.
Correct:
@using Syncfusion.Blazor.Toolkit.Buttons
<a href="/detail/42" role="link">
<SfButton Content="Open"
CssClass="e-link"
HtmlAttributes="@(new Dictionary<string, object> { ["aria-label"] = "Open detail 42" })"/>
</a>
CssClass="e-link" re-skins the button as a link, removing the button
semantics; the anchor remains the real interactive role.
Workflow 4 — Agent assumes Disabled="@isProcessing" clears via the button click
Bad:
<SfButton Disabled="@_isProcessing" OnClick="SubmitAsync">Submit</SfButton>
@code {
private async Task SubmitAsync(MouseEventArgs _) { _isProcessing = true; await DoWork(); }
// submit fires but `_isProcessing` is never set back to false ⇒ permanent lock
}
Why it fails: Disabled is one-way; the click handler must clear the
flag itself.
Correct:
@using Syncfusion.Blazor.Toolkit.Buttons
<SfButton Disabled="@_isProcessing" OnClick="SubmitAsync">Submit</SfButton>
@code {
private bool _isProcessing;
private async Task SubmitAsync(MouseEventArgs _)
{
if (_isProcessing) return;
_isProcessing = true;
try { await DoWork(); }
finally { _isProcessing = false; } // mandatory clear
}
}
Or: simpler, rely on the framework's IsBusy/ButtonState pattern or
a wrapping <SfSpinner> overlay (see
syncfusion-blazor-toolkit-notifications).
Minimal Example
@using Syncfusion.Blazor.Toolkit.Buttons
<SfButton Content="Save"
IsPrimary="true"
OnClick="@SaveAsync" />
@code {
private async Task SaveAsync(MouseEventArgs _)
{
// your async work; see Workflow 1 for the busy-flag pattern
}
}
Documentation and Navigation Guide
| Need | Read |
|---|---|
| First button / project setup | references/getting-started.md |
Styling, Disabled, CssClass | references/button-fundamentals.md |
Icons, Content vs ChildContent | references/icons-and-content.md |
Events, EventCallback, async patterns | references/events-and-callbacks.md |
SfButtonGroup, selection modes | references/button-group.md |
Full property reference for
SfButton,SfButtonGroup, and innerButtonlives inreferences/button-fundamentals.mdandreferences/button-group.md.
Next Steps
- Start Simple: Read references/getting-started.md
- Style and Configure: Explore references/button-fundamentals.md
- Add Interactivity: Learn references/events-and-callbacks.md
- Expand: Grouping in references/button-group.md
Demo: https://blazor.syncfusion.com/demos/toolkit/buttons/button
When not to use it
- →Non-Blazor applications
- →Native HTML button requirements
Prerequisites
Limitations
- →Requires Syncfusion Blazor Toolkit
How it compares
It offers specialized guidance for Syncfusion-specific properties and accessibility features not found in standard Blazor buttons.
Compared to similar skills
syncfusion-blazor-toolkit-buttons side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| syncfusion-blazor-toolkit-buttons (this skill) | 0 | 3mo | No flags | Beginner |
| syncfusion-maui-digital-gauge | 0 | 6mo | No flags | Beginner |
| component-development | 1 | 6mo | Review | Intermediate |
| avalonia-viewmodels-zafiro | 0 | 8mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by syncfusion
View all by syncfusion →You might also like
syncfusion-maui-digital-gauge
syncfusion
Implements Syncfusion .NET MAUI DigitalGauge (SfDigitalGauge) control to display alphanumeric characters in LED-style digital format. Use when working with digital gauges, LED displays, seven-segment displays, digital clocks, or digital counters. Ideal for displaying numbers, letters, or special cha
component-development
FritzAndFriends
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.
avalonia-viewmodels-zafiro
davila7
Optimal ViewModel and Wizard creation patterns for Avalonia using Zafiro and ReactiveUI.
syncfusion-blazor-toolkit-calendars
syncfusion
Build and customize calendar-based components in Syncfusion Blazor Toolkit. Covers Calendar, DatePicker, DateTimePicker, and TimePicker. Use when implementing date/time selection features, handling date range restriction, formatting dates, managing calendar events, validating dates, or customizing c
dotnet-blazor
managedcode
Build and review Blazor applications across server, WebAssembly, web app, and hybrid scenarios with correct component design, state flow, rendering, and hosting choices.
dotnet-spectre-console
rudironsoni
>-