First you need to capture a reference of your child component:
<ChildComponent @ref="child" />
Then you can use this reference to call the child’s component methods as you do in your code.
<button onClick="@ShowModal">show modal</button>
@code{
ChildComponent child;
void ShowModal(){
child.Show();
}
}
The namespace of your component need to be added by a using either in the page or in _Imports.razor. If your component is in the sub folder Components/ChildComponent.razor then its namespace is {YourAppNameSpace}.Components
@using MyBlazorApp.Components
read the code