ComponentParameterCollectionBuilder<TComponent> Class

Sets the parameters of a component, with the names of its properties checked by the compiler.

public sealed class ComponentParameterCollectionBuilder<TComponent> where TComponent : IComponent

Type parameters

TComponent
The type of the component.

Methods

NameDescription
Add(Expression<Func<TComponent, EventCallback>>, Action)Sets an EventCallback parameter.
Add(Expression<Func<TComponent, EventCallback>>, Func<Task>)Sets an EventCallback parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes (an async lambda selects this overload, not the Action one).
Add(Expression<Func<TComponent, RenderFragment?>>, string)Sets a RenderFragment parameter from markup.
Add(string, object?)Sets a parameter by name, for instance an attribute captured by CaptureUnmatchedValues.
Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Action<TValue>)Sets an EventCallback<TValue> parameter.
Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Func<TValue, Task>)Sets an EventCallback<TValue> parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes.
Add<TValue>(Expression<Func<TComponent, TValue>>, TValue)Sets a parameter.
AddChildContent(RenderFragment)Sets the ChildContent parameter.
AddChildContent(string)Sets the ChildContent parameter from markup.

Add overloads

Add(Expression<Func<TComponent, EventCallback>>, Action)

ComponentParameterCollectionBuilder.cs

Sets an EventCallback parameter.

public ComponentParameterCollectionBuilder<TComponent> Add(Expression<Func<TComponent, EventCallback>> parameter, Action callback)
Parameters
parameter Expression<Func<TComponent, EventCallback>>
The property of the parameter (c => c.OnClick).
callback Action
The callback.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Add(Expression<Func<TComponent, EventCallback>>, Func<Task>)

ComponentParameterCollectionBuilder.cs

Sets an EventCallback parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes (an async lambda selects this overload, not the Action one).

public ComponentParameterCollectionBuilder<TComponent> Add(Expression<Func<TComponent, EventCallback>> parameter, Func<Task> callback)
Parameters
parameter Expression<Func<TComponent, EventCallback>>
The property of the parameter (c => c.OnClick).
callback Func<Task>
The callback.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Add(Expression<Func<TComponent, RenderFragment?>>, string)

ComponentParameterCollectionBuilder.cs

Sets a RenderFragment parameter from markup.

public ComponentParameterCollectionBuilder<TComponent> Add(Expression<Func<TComponent, RenderFragment?>> parameter, string markup)
Parameters
parameter Expression<Func<TComponent, RenderFragment?>>
The property of the parameter (c => c.ChildContent).
markup string
The HTML of the fragment.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Sets a parameter by name, for instance an attribute captured by CaptureUnmatchedValues.

public ComponentParameterCollectionBuilder<TComponent> Add(string name, object? value)
Parameters
name string
The name of the parameter.
value object?
The value.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Action<TValue>)

ComponentParameterCollectionBuilder.cs

Sets an EventCallback<TValue> parameter.

public ComponentParameterCollectionBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>> parameter, Action<TValue> callback)
Type parameters
TValue
The type of the argument of the callback.
Parameters
parameter Expression<Func<TComponent, EventCallback<TValue>>>
The property of the parameter (c => c.ValueChanged).
callback Action<TValue>
The callback.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Func<TValue, Task>)

ComponentParameterCollectionBuilder.cs

Sets an EventCallback<TValue> parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes.

public ComponentParameterCollectionBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>> parameter, Func<TValue, Task> callback)
Type parameters
TValue
The type of the argument of the callback.
Parameters
parameter Expression<Func<TComponent, EventCallback<TValue>>>
The property of the parameter (c => c.ValueChanged).
callback Func<TValue, Task>
The callback.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Add<TValue>(Expression<Func<TComponent, TValue>>, TValue)

ComponentParameterCollectionBuilder.cs

Sets a parameter.

public ComponentParameterCollectionBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, TValue>> parameter, TValue value)
Type parameters
TValue
The type of the parameter.
Parameters
parameter Expression<Func<TComponent, TValue>>
The property of the parameter (c => c.Title).
value TValue
The value.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

AddChildContent overloads

AddChildContent(RenderFragment)

ComponentParameterCollectionBuilder.cs

Sets the ChildContent parameter.

public ComponentParameterCollectionBuilder<TComponent> AddChildContent(RenderFragment childContent)
Parameters
childContent RenderFragment
The content.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.

Sets the ChildContent parameter from markup.

public ComponentParameterCollectionBuilder<TComponent> AddChildContent(string markup)
Parameters
markup string
The HTML of the content.
Returns

ComponentParameterCollectionBuilder<TComponent> The builder.