Skip to content

Conversation

dev-viinz
Copy link

Linked Issue

Closes #3468

Description

Adds the TreeView component in the new v4 flavour.

Checklist

Please read and apply all contribution requirements.

  • Your branch should be prefixed with: docs/, feature/, chore/, bugfix/
  • Contributions should target the main branch
  • Documentation should be updated to describe all relevant changes
  • Run pnpm check in the root of the monorepo
  • Run pnpm format in the root of the monorepo
  • Run pnpm lint in the root of the monorepo
  • Run pnpm test in the root of the monorepo
  • If you modify /package projects, please supply a Changeset

Changesets

View our documentation to learn more about Changesets. To create a Changeset:

  1. Navigate to the root of the monorepo in your terminal
  2. Run pnpm changeset and follow the prompts
  3. Commit and push the changeset before flagging your PR review for review.

Copy link

changeset-bot bot commented Aug 31, 2025

⚠️ No Changeset found

Latest commit: a60f026

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Aug 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
themes.skeleton.dev Building Building Preview Comment Sep 8, 2025 6:28pm
www.skeleton.dev Ready Ready Preview Comment Sep 8, 2025 6:28pm

Copy link
Contributor

@Hugos68 Hugos68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic and implementation LGTM!

If you're upto the task, feel free to get started with the React implementation.

Per the styling and design I say we request a review from Chris, as he is the designer among the Skeleton team.

@Hugos68 Hugos68 requested a review from endigo9740 September 2, 2025 10:19
@endigo9740
Copy link
Contributor

@dev-viinz @Hugos68 this is on my agenda for review. Just won't have time today. Will aim for tomorrow!

Copy link
Contributor

@endigo9740 endigo9740 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is in a great place Viinz. You've adapted to the v4 conventions very well.

In addition to my specific comments below. We need a couple things prior to moving on to React please:

  1. We need icons implemented. See Zag's doc example for placement. Follow our example from the recently updated RatingsGroup component (PR may still be pending) where internalized Lucide SVGs to serve as the defaults. Then provide entry (snippets, etc) for replacing these with user-defined alternatives. This should include a directory, file, and arrow. And the arrow should be able to toggle state (read: rotate) like Accordions.
  2. The design is functional, but let once all feedback in this pass is applied I'll do another pass pass. Then you can carry that directly to the React iteration
  3. Once all changes are in place, go ahead and setup the Documentation pages and start generating examples. It's fine to limit these to Svelte only for now. Just create a placeholder mdx page for React.

@Hugos68 FYI for all this

*
* @defaultValue 3
*/
level?: 1 | 2 | 3 | 4 | 5 | 6;
Copy link
Contributor

@endigo9740 endigo9740 Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we had a similar discussion around the implementation of the label for the past iteration. For examples, make sure to set a Skeleton .h{1-6} class on the element itself. And remember Tailwind classes cannot be generated, so if they add 1 for the level, apply h1 verbatim.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually don't do this for the Accordion.Heading, should that be implemented there aswell?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hugos68 yes, please

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, though you should probably have a look at my implementation, not sure if it's how you want it structured :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Viinz, your implementation is fine, the only problem we need to solve is that now the heading isn't included as part of the classlist on the docsite. So users can't see this is applied. I'll try to think on how to solve this, but I like what you did here.

});
</script>

{#snippet treeNode(nodeProps: TreeViewNodeProps)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's due to the recursive nature of the component, but having to define a snippet for every instance of the Tree View nodes is very confusing at first glance. This is likely going to trip up casual users.

Let's make sure we explain this when we implement the documentation. Something like this:

Since Tree View nodes are used recursively, we implement a {descriptor} to enable this.

  • Svelte descriptor: Snippet
  • React descriptor: a component

@Hugos68
Copy link
Contributor

Hugos68 commented Sep 4, 2025

@dev-viinz Just wanted to let you know we've introduced an @ alias for imports inside our component packages.

So:
../../../internal
can now become:
@/internal.

You may replace all the relative calls with that. Find a replace makes this a breeze as all relative paths have the same depth thanks to our consistent folder structure.

@Hugos68 Hugos68 changed the title feat: tree view (v4) feat: treeview Sep 5, 2025
@Hugos68 Hugos68 changed the title feat: treeview feat: tree view Sep 5, 2025
@Hugos68 Hugos68 changed the title feat: tree view feat: tree view (pending convention update) Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Tree View Component
3 participants