@inherits DComponentBase @* daisyUI Table: https://daisyui.com/components/table/ . ChildContent is the // markup. Class and the other attributes go on the ; with Scroll (the default) it sits in an overflow-x-auto div, whose classes are WrapperClass (pinned rows need it to have a height, e.g. h-96). *@ @if (Scroll) {
@ChildContent
} else { @ChildContent
} @code { [Parameter] public RenderFragment ChildContent { get; set; } [Parameter] public DSize Size { get; set; } [Parameter] public bool Zebra { get; set; } /// Sticky thead/tfoot rows while the wrapper scrolls vertically. [Parameter] public bool PinRows { get; set; } /// Sticky <th> columns while the wrapper scrolls horizontally. [Parameter] public bool PinCols { get; set; } /// Wrap the table in an overflow-x-auto div so it scrolls on narrow screens. [Parameter] public bool Scroll { get; set; } = true; [Parameter] public string WrapperClass { get; set; } string CssClass => Cx("table", Zebra ? "table-zebra" : null, PinRows ? "table-pin-rows" : null, PinCols ? "table-pin-cols" : null, SizeClass, Class); string SizeClass => Size switch { DSize.Xs => "table-xs", DSize.Sm => "table-sm", DSize.Lg => "table-lg", DSize.Xl => "table-xl", _ => null }; }