Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Adaptability

Since 0.1.0-alpha.24
On a phone or in a narrow panel, the tree list hides the columns that don't fit and shows their values under the row.

Columns that hide

To hide the columns that don't fit a narrow screen instead of scrolling sideways, set SmallScreen="DataGridSmallScreen.HideColumns". Columns hide lowest Priority first, and a button at the end of each row shows their values under it.

Preview

People on a phone
Name
TitleLocationStartedDetails
Maya OkaforChief Executive OfficerNew YorkMar 2016

Code

Narrow.razor
@* The org chart on a phone: Started, then Location, then Title hide as the tree narrows, and a
   button at the row's end shows them under it, at its level. Names stay, with their indent. Switch to Phone. *@
<TreeList Items="_people" ItemKey="p => p.Id.ToString()" ItemParentKey="p => p.ManagerId?.ToString()"
          ItemExpanded="p => p.ManagerId is null" RowLabel="p => p.Name" SmallScreen="DataGridSmallScreen.HideColumns"
          QueryPrefix="org-narrow-" Caption="People on a phone">
    <Columns>
        <PropertyColumn Property="p => p.Name" />
        <PropertyColumn Property="p => p.Title" Width="14.Rem" Priority="3" />
        <PropertyColumn Property="p => p.Location" Width="8.Rem" Priority="2" />
        <PropertyColumn Property="p => p.Started" Format="MMM yyyy" Width="7.Rem" Priority="1" />
    </Columns>
</TreeList>

@code {
    private readonly Person[] _people =
    [
        new(1, null, "Maya Okafor", "Chief Executive Officer", "New York", new(2016, 3, 1)),
        new(2, 1, "Daniel Reyes", "VP of Engineering", "Austin", new(2017, 6, 12)),
        new(3, 2, "Priya Natarajan", "Engineering Manager, Platform", "Austin", new(2018, 9, 4)),
        new(4, 3, "Tom Becker", "Senior Software Engineer", "Remote", new(2019, 1, 14)),
        new(5, 3, "Lena Fischer", "Software Engineer", "Austin", new(2022, 5, 2)),
        new(6, 3, "Omar Haddad", "Site Reliability Engineer", "Remote", new(2021, 8, 23)),
        new(7, 2, "Grace Kim", "Engineering Manager, Apps", "New York", new(2019, 4, 8)),
        new(8, 7, "Lucas Moreau", "Senior Software Engineer", "New York", new(2020, 2, 17)),
        new(9, 7, "Aisha Bello", "Software Engineer", "Remote", new(2023, 1, 9)),
        new(10, 1, "Sofia Rossi", "VP of Sales", "Chicago", new(2018, 1, 22)),
        new(11, 10, "James O'Connor", "Account Executive", "Chicago", new(2020, 10, 5)),
        new(12, 10, "Mei Lin", "Account Executive", "San Francisco", new(2022, 3, 28)),
        new(13, 10, "Carlos Mendes", "Sales Engineer", "Remote", new(2021, 6, 14)),
        new(14, 1, "Hannah Weiss", "Head of People", "New York", new(2019, 11, 11)),
        new(15, 14, "Kwame Asante", "Recruiter", "New York", new(2023, 7, 31)),
        new(16, 1, "Ravi Shah", "Chief Financial Officer", "New York", new(2020, 5, 18)),
        new(17, 16, "Elena Petrova", "Controller", "New York", new(2021, 2, 1)),
    ];
}

The first column stays, with each row's indent and chevron, so the tree still reads; the button is at the row's end, as a DataGrid's would sit beside the tree's chevron. A row's hidden values open under it at its level, and stay open as the rows around it open and close.

Connection lost

Rejoining the server…