Modern Theme

« Extensions

The Modern theme provides a clean, framework-agnostic look with card-style container, refined headers, hover states, and self-contained pager and search styling. No Bootstrap table classes required.

Full Example

Apply the theme, then configure sorting, paging, search, and columns as needed:

Clear
Name▲▼ Movie Director▲▼ Genre▲▼ Released▲▼
Close Encounters of the Third Kind Steven Spielberg Sci-Fi 1997
Movie with <b>bold</b> This Guy Test
Pulp Fiction Quentin Tarantino Action 1994
Reservoir Dogs Quentin Tarantino Thriller 1992
Rocky John G. Avildsen Action

@(await Html
    .SimpleGrid(Model)
    .Theme(GridTheme.Modern)
    .Sortable()
    .DefaultSortBy(m => m.Name)
    .AddColumn(col => col.For(m => m.Name).Sortable())
    .AddColumn(col => col.For(m => m.Director).Sortable())
    .AddColumn(col => col
        .Header("Genre")
        .DisplayAs(m => $"<span class='sh-badge sh-badge-info'>{WebUtility.HtmlEncode(m.Genre)}</span>")
        .Encoded(false)
        .SortableBy(m => m.Genre))
    .AddColumnFor(m => m.Released)
    .AddSearch("Name", ...)
    .AddSearch("Director", ...)
    .AddPager(options => { ... })
    .RenderAsync())

Row Modifiers

Highlight rows based on conditions:


@(await Html
    .SimpleGrid(Model)
    .Theme(GridTheme.Modern)
    .AddColumnsForModel()
    .Sortable()
    .DefaultSortBy(m => m.Name)
    .AddRowModifier(
        m => m.Released.HasValue && m.Released.Value < 1980,
        css => css.AddClass("sh-row-warning"))
    .RenderAsync())

Side by Side: Classic vs Modern

Classic (default)
Name Movie Director Movie Genre Released
No matching records.

CSS Classes Available

Class Usage Preview
No matching records.