Add and Remove Items in Blazor SplitButton Component

29 Jul 20211 minute to read

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

The following example illustrates how to add and remove items in Split Button component.

@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>()

Output be like

Split Button Sample