Previous tip (Tailwind 3 and ASP.NET Core) Next tip (Link to your components) >>

One-way binding

Declare a field or property in your Blazor component’s @code directive.

Render the field or property’s value in your markup using the @ symbol, followed by the name of the property or field.

<h1>Hello @name</h1>
// Renders "<h1>Hello Alice</h1>"
@code {
string name = "Alice";
}