Library Blazor Components Toggle Reference Classes Toggle Properties ChildContent

ChildContent

Specifies a content that can be injected inside toggle.

razor
[Parameter]
public RenderFragment? ChildContent { get; set; }

ChildContent

Example

In this example we have different content depended on value of IsChecked parameter.

razor
<Toggle @bind-IsChecked="@_isChecked">
    <div>
        @if (_isChecked)
        {
            // content for checked state
        }
        else
        {
            // content for unchecked state
        }
    </div>
</Toggle>

@code {
    bool _isChecked;
}

Sign in