Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Tree View Org Chart Team Block for React

A split org chart for a ride-share fleet: copy, an Expand all button and three figures at the start, and a working tree of twenty-two people at the end, with a band that names the picked person's manager and reports.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

An org chart for React with Base UI, for Merlinby, a ride-share fleet. A start-aligned header says who answers to whom, with an Expand all button and three figures (people, departments, levels) under it. Past a solid divider that meets the top rule at a + mark, the chart is a working tree: the chief executive, three vice presidents, their managers and the people who report to them, twenty-two in all. Each row is an initials avatar, a name, a role and the person's count of direct reports; a hairline guide runs down each level. The tree opens already three levels deep and scrolls inside its own frame, so opening every branch never moves the page. Picking anyone fills the band that ends the block: who they report to and who reports to them. On a phone the tree sits under the copy and its indents are tighter. It's built from Tree View, Avatar, Button and Guides, with CSS transitions and your theme's tokens for every colour. For about pages, investor decks and onboarding pages where "who is my manager" is a real question.

FAQ

How do I change the people and who reports to whom?

Edit ORG at the top of the file. A person is an id, a name, a role and, if they manage anyone, a reports list of more people, nested as deep as you like. The tree, the "22 reports" counts, the figure for people and the figure for departments are all read from that one structure. The "Levels" figure is a number you set yourself (LEVELS), so update it if you change the depth.

How do I use the tree with a keyboard?

The tree is the catalog's Tree View, which is built on Ark UI on every target. Tab moves into it, the Up and Down arrows move between visible rows, Right opens a branch and Left closes it, and Enter picks the person, which fills the band under the tree. Every row is a tree item with a name that reads the person, their role and their number of reports. Expand all and Collapse all are one button whose label changes.

Are the people under a closed branch in the page?

No. The Tree View mounts a branch's rows only while it is open, so a closed branch holds nothing in the HTML and Expand all adds the rest. If you need every name in the markup for search engines, list the team elsewhere on the page as well.

Why does the tree scroll inside a frame?

Opening every branch shows twenty-two rows, which would push everything below the block down. The tree sits in a frame of fixed height with its own scroll, so Expand all and Collapse all never move the page, and the eight rows it opens with fit without scrolling. The frame is taller on a desktop than on a phone.

What does picking a person do?

It marks their row with a bar and a tint and fills the band at the end of the block with their name, role, who they report to and who reports to them ("Reports to Priya Raman. Manages Anya Volkova and Kofi Mensah."). The band is a polite live region, so a screen reader hears the change without losing its place in the tree.

How does it fit on a phone?

Below lg the header comes first, then the Expand all button and the three figures, then the tree under a hairline, then the picked-person band. The tree's indents are tighter, role lines wrap onto a second line, and nothing scrolls sideways at 320 pixels.

  • Pro

    Drill-Down Org Chart Team

    Leaders and org charts

    A claims desk as a drill-down in a framed figure of three columns: pick a head of function, then a team lead, and each pick fills the next column; on a phone one list shows at a time under a breadcrumb that steps back.

  • Pro

    Collaboration Ring Graph Team

    Leaders and org charts

    Nine people of a hospital rota company on a ring joined by chords: pick one and their chords go strong, the people they work with stay in tone, and a list says who they work with most and for how many hours a week.

  • Pro

    Squad Matrix Team

    Leaders and org charts

    Six squads of a grocery loyalty app as a captioned table: a row per squad with its mission, a column per function, and in each cell the person who covers it as an initials avatar and a name, or a dash.

  • Pro

    Org Chart Showcase Hero

    Diagrams and maps

    A showcase hero for a people platform: centred copy and a Shine Button above a full-width tinted band that holds a three-level org chart.

  • Pro

    Department Tabs Team

    Tabs and accordions

    Thirty people of a grocery-delivery company by department: underline tabs with headcounts, then each panel opens with its lead on a tinted band and the team as two columns of hairline rows.

  • Pro

    Advisory Board Table Team

    Leaders and org charts

    Seven advisors of a climate-risk model company in a captioned table from rail to rail: an initials avatar and a name, their role and firm, their specialty and the year they began advising.