In this post, we will discuss about Arbitrary Parameters and Attribute Splatting in blazor in detail.

As you already know, Blazor is a component based UI framework. It means each page, each form or each block can be a component in blazor. Since the component is a reusable element , so the blazor components can also be nested. Meaning a component in blazor can be nested inside other blazor components.

We have described blazor components in detail in my previous article Deep Dive on Blazor Components. If you have not gone through it yet, please read it first.

Before explaining about arbitrary parameters and attribute splatting in blazor, it is necessary to understand about how blazor components can be nested and how a parent component can pass any data to its child components using [Parameter] attribute. For understanding in detail, you can check it here.

You can download demo project with examples explained from GitHub.

Let’s quickly recap about component parameter here in this post also with the help of an example.

Passing data from parent component to child component using [Parameter] attribute

A parent component in blazor can pass data to its child components using [Parameter] attribute. In the following example, parent component (Index.razor) can pass placeholder property value to its child component (DisplayName.razor).

#blazor #@attributes directive #arbitrary parameters #attribute splatting #captureunmatchedvalues

Arbitrary Parameters And Attribute Splatting In Blazor
8.15 GEEK