Add and Remove Items in Blazor SplitButton Component

11 Oct 20211 minute to read

Split Button component can dynamically add or remove items using AddItems, RemoveItems method.

@using Syncfusion.Blazor.SplitButtons
@using Syncfusion.Blazor.Buttons

<SfSplitButton Content="Paste Items" @ref="SplitbuttonRef">
        <DropDownMenuItem Text="Paste"></DropDownMenuItem>
    <SfButton Content="Additem" IsPrimary="true" @onclick="addItem"></SfButton>

    <SfButton Content="Removeitem" IsPrimary="true" @onclick="removeItem"></SfButton>

@code {
    SfSplitButton SplitbuttonRef;

    private void addItem()

    private void removeItem()
    public List<DropDownMenuItem> SplitbtnItems = new List<DropDownMenuItem>
        new DropDownMenuItem{ Text="Paste Special" },
        new DropDownMenuItem{ Text="Paste as Formula" },
        new DropDownMenuItem{ Text="Paste as Hyperlink" }

    public List<string> removeItems = new List<string>()

Adding or Removing Blazor SplitButton Items