# Table > Compound component for structured tabular data with semantic HTML. Source: https://shellui.dev/docs/v0.3/components/data-display/table ## Overview The Table component is a compound component that renders semantic HTML tables. Each sub-component (`TableHeader`, `TableBody`, `TableRow`, `TableHead`, `TableCell`) accepts `ChildContent` and an optional `Class` parameter merged via `Shell.Cn()`. ## Installation ```bash shellui add table ``` ## Usage ### Basic Table ```razor Name Email Role John Doe john@example.com Admin Jane Smith jane@example.com User
``` ### Dynamic Data ```razor Name Email Role @foreach (var user in users) { @user.Name @user.Email @user.Role }
@code { private List users = new() { new() { Name = "Alice Johnson", Email = "alice@example.com", Role = "Admin" }, new() { Name = "Bob Wilson", Email = "bob@example.com", Role = "User" } }; private class UserModel { public string Name { get; set; } = ""; public string Email { get; set; } = ""; public string Role { get; set; } = ""; } } ``` ### Table with Actions ```razor Name Status Actions Alice Johnson Active
``` ### Responsive Wrapper ```razor
``` ## API Reference ### Table | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `ChildContent` | `RenderFragment` | — | Table header and body | | `Class` | `string?` | `null` | Additional CSS classes | ### TableHeader | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `ChildContent` | `RenderFragment` | — | Header rows | | `Class` | `string?` | `null` | Additional CSS classes | ### TableBody | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `ChildContent` | `RenderFragment` | — | Data rows | | `Class` | `string?` | `null` | Additional CSS classes | ### TableRow | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `ChildContent` | `RenderFragment` | — | Cells within the row | | `Class` | `string?` | `null` | Additional CSS classes | ### TableHead | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `ChildContent` | `RenderFragment` | — | Header cell content | | `Class` | `string?` | `null` | Additional CSS classes | ### TableCell | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `ChildContent` | `RenderFragment` | — | Data cell content | | `Class` | `string?` | `null` | Additional CSS classes | ## Accessibility - Renders semantic ``, ``, ``, ``, `
`, and `` elements. - Screen readers can navigate by row and column. - Use `` for column headers so assistive technology identifies them correctly.