Try SSR
Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Light
Dark
System
Docs
Select Color Scheme
Default
Awesome
Shoelace
Active
Brutalist
Glossy
Matter
Mellow
Playful
Premium
Tailspin
Docs
Select Theme
Trees allow you to display a hierarchical list of selectable tree items. Items with children can be expanded
and collapsed as desired by the user.
Deciduous
Birch
Maple
Field mapleRed mapleSugar mapleOakWalnut
Coniferous
Cedar
Pine
Eastern white pinePonderosa pineScots pineSpruceFir
Tropical
BanyanCoconut palmMahoganyTeak
<wa-treestyle="--indent-guide-width: 1px;"><wa-tree-itemexpanded>
Deciduous
<wa-tree-item>Birch</wa-tree-item><wa-tree-itemexpanded>
Maple
<wa-tree-item>Field maple</wa-tree-item><wa-tree-item>Red maple</wa-tree-item><wa-tree-item>Sugar maple</wa-tree-item></wa-tree-item><wa-tree-item>Oak</wa-tree-item><wa-tree-item>Walnut</wa-tree-item></wa-tree-item><wa-tree-item>
Coniferous
<wa-tree-item>Cedar</wa-tree-item><wa-tree-item>
Pine
<wa-tree-item>Eastern white pine</wa-tree-item><wa-tree-item>Ponderosa pine</wa-tree-item><wa-tree-item>Scots pine</wa-tree-item></wa-tree-item><wa-tree-item>Spruce</wa-tree-item><wa-tree-item>Fir</wa-tree-item></wa-tree-item><wa-tree-item>
Tropical
<wa-tree-item>Banyan</wa-tree-item><wa-tree-item>Coconut palm</wa-tree-item><wa-tree-item>Mahogany</wa-tree-item><wa-tree-item>Teak</wa-tree-item></wa-tree-item></wa-tree>
Examples
Link to This Section
Selection Modes
Link to This Section
The selection attribute lets you change the selection behavior of the tree.
Use single to allow the selection of a single item (default).
Use multiple to allow the selection of multiple items.
Use leaf to only allow leaf nodes to be selected.
Use leaf-multiple to allow the selection of multiple leaf nodes.
Trees inherit their font size by default. You can change the size of a tree and all of its items by setting font-size on the <wa-tree> element. All internal dimensions, including checkboxes, expand buttons, and labels, scale proportionally.
Small
Newsletters
Promotions
Weekly dealsSeasonal sales
Default
Newsletters
Promotions
Weekly dealsSeasonal sales
Large
Newsletters
Promotions
Weekly dealsSeasonal sales
Indent guides can be drawn by setting --indent-guide-width. You can also change the color, offset, and style, using --indent-guide-color, --indent-guide-style, and --indent-guide-offset, respectively.
Design
Brand
ColorsTypographyLogo
Components
ButtonsFormsNavigation
Development
FrontendBackendInfrastructure
Marketing
Social MediaEmail CampaignsAnalytics
Use the lazy attribute on a tree item to indicate that the content is not yet present and will be loaded later. When the user tries to expand the node, the loading state is set to true and the wa-lazy-load event will be emitted to allow you to load data asynchronously. The item will remain in a loading state until its content is changed.
If you want to disable this behavior after the first load, simply remove the lazy attribute and, on the next expand, the existing content will be shown instead.
Remote Repositories
<wa-tree><wa-tree-itemlazy>Remote Repositories</wa-tree-item></wa-tree><scripttype="module">const lazyItem = document.querySelector('wa-tree-item[lazy]');
lazyItem.addEventListener('wa-lazy-load',()=>{// Simulate fetching data from a serversetTimeout(()=>{const repos =['design-system','marketing-site','mobile-app','api-gateway'];for(const repo of repos){const treeItem = document.createElement('wa-tree-item');
treeItem.innerText = repo;
lazyItem.append(treeItem);}// Disable lazy mode once the content has been loaded
lazyItem.lazy =false;},1000);});</script>
Customizing the Expand and Collapse Icons
Link to This Section
Use the expand-icon and collapse-icon slots to change the expand and collapse icons, respectively. To disable the animation, override the rotate property on the expand-button part as shown below.
Recipes
Breakfast
PancakesOmeletteGranola
Lunch
Caesar saladGrilled chicken wrap
Dinner
Pasta carbonaraStir fryRoasted salmon
Desserts
Chocolate cakeTiramisuFruit tart
If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To
cherry-pick a component manually, use one of the following snippets.
The selection behavior of the tree. Single selection allows only one node to be selected at a time. Multiple
displays checkboxes and allows more than one node to be selected. Leaf allows only leaf nodes to be selected.
Leaf-multiple allows multiple leaf nodes to be selected while parent nodes only expand and collapse.