/// <summary>
 /// Opens a component block of the given type, adding the given id and CSS class
 /// attributes and setting its key, if provided.
 /// </summary>
 /// <remarks>
 /// Note: Each call to this method must be matched with a call to
 /// <see cref="FluentRenderTreeBuilder.Close(bool, int)">Close(...)</see>.
 /// </remarks>
 /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param>
 /// <param name="type">The <see cref="Type"/> of the component to open.</param>
 /// <param name="class">The optional CSS class name.</param>
 /// <param name="id">The optional id attribute value.</param>
 /// <param name="key">The optional key to set for this element.</param>
 /// <param name="prettyPrint"><c>false</c> to prevent insertion of newline and indent
 /// whitespace before the markup for this element, even if
 /// <see cref="FluentRenderTreeBuilder.PrettyPrinting"/> is enabled.</param>
 /// <param name="line">The source code line number used to generate the sequence number.</param>
 public static FluentRenderTreeBuilder OpenComponent(this FluentRenderTreeBuilder frtb, Type type,
                                                     string? @class = null, string?id = null, object?key = null, bool prettyPrint = true,
                                                     [CallerLineNumber] int line = 0)
 => frtb
 .OpenComponent(type, prettyPrint, line)
 .SetKey(key)
 .Id(id, line)
 .Class(@class, line);
 /// <summary>
 /// Generates a component block of the specified type, adding the given id and CSS class
 /// attributes and setting its key, if provided.
 /// </summary>
 /// <remarks>
 /// Note: This block is automatically closed, so calling
 /// <see cref="FluentRenderTreeBuilder.Close(bool, int)">Close(...)</see> is unnecessary.
 /// </remarks>
 /// <typeparam name="TComponent">The <see cref="Type"/> of the component.</typeparam>
 /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param>
 /// <param name="class">The optional CSS class name.</param>
 /// <param name="id">The optional id attribute value.</param>
 /// <param name="key">The optional key to set for this element.</param>
 /// <param name="prettyPrint"><c>false</c> to prevent insertion of newline and indent
 /// whitespace before the markup for this element, even if
 /// <see cref="FluentRenderTreeBuilder.PrettyPrinting"/> is enabled.</param>
 /// <param name="line">The source code line number used to generate the sequence number.</param>
 public static FluentRenderTreeBuilder Component <TComponent>(this FluentRenderTreeBuilder frtb,
                                                              string? @class = null, string?id = null, object?key = null, bool prettyPrint = true,
                                                              [CallerLineNumber] int line = 0)
     where TComponent : IComponent
 => frtb
 .OpenComponent <TComponent>(prettyPrint, line)
 .SetKey(key)
 .Id(id, line)
 .Class(@class, line)
 .Close(prettyPrint, line);