vscode-webview-ui-toolkit icon indicating copy to clipboard operation
vscode-webview-ui-toolkit copied to clipboard

Collapsible panel section component

Open estruyf opened this issue 4 years ago • 10 comments

Feature/component description

Creation of an accordion / collapsible section component. Similar to the panel sections which you have on the explorer panel.

Use case

To create an experience that comes close to the OOTB VS Code experience in your webviews, it would be great to have a collapsible section component.

Screenshots/references

Screenshot 2021-10-12 at 10 38 41

estruyf avatar Oct 12 '21 08:10 estruyf

Thanks for the request!

To help a bit more with my understanding could you provide some examples or ideas of what you would use the accordion for?

For example, is your hope that the accordion would contain a tree view (like in the photo above) or some other content? If you have an extension idea or extension that you actively work on where would the accordion fit into that extension?

hawkticehurst avatar Oct 12 '21 20:10 hawkticehurst

@hawkticehurst I use the accordion to mimic the same behavior in my Front Matter panel (https://frontmatter.codes/) as all other panels from VS Code.

image

I just want to be able to render any kind of HTML elements in it, not only a tree view.

estruyf avatar Oct 13 '21 06:10 estruyf

Another example of collapse/expand. I have "tasks.json" graphical editor: image

idoprz avatar Oct 13 '21 15:10 idoprz

I just want to be able to render any kind of HTML elements in it, not only a tree view.

Sorry, one more clarification since I may be misunderstanding, but does the image you sent not already have arbitrary HTML inside the collapsable sidebar Webview Views?

accordian-vscode

hawkticehurst avatar Oct 27 '21 16:10 hawkticehurst

Another example of collapse/expand. I have "tasks.json" graphical editor

Thanks! That's helpful.

hawkticehurst avatar Oct 27 '21 16:10 hawkticehurst

I had a similar question re: rendering HTML in a panel. @estruyf are you currently using this Webview View API?

Webview views that are rendered in the sidebar or panel areas. See the webview view sample extension for more details

Based on the screenshots, I assume you already are. If that's the case, is it simply a matter of wanting that same component in an editor panel instead of the sidebar?

daviddossett avatar Oct 27 '21 17:10 daviddossett

Correct @daviddossett, I'm using it in a webview. Having the web component available would allow us to reuse it in custom sidebars and align the style.

estruyf avatar Oct 28 '21 06:10 estruyf

Thanks for the clarification @estruyf! The last question I have is if you could give a bit more information/screenshots about the task.json example.

It seems pretty straightforward and makes me wonder if it would be possible to implement a sort of hybrid extension that uses both the TreeView API and Webview API in a similar fashion to the notepad sample extension?

That way you get the built-in styling of a collapsible UI element (not to mention the speed of a native API), along with the flexibility of rendering whatever content you need inside a webview.

But again I could certainly be misinterpreting the screenshot you sent so any further info would be appreciated!

hawkticehurst avatar Oct 28 '21 21:10 hawkticehurst

The tasks.json was actually my example. 🙄 We do have tasks in a TreeView. But if you want to see the task dependent tasks, it should be in a tree inside the webview.

idoprz avatar Oct 29 '21 05:10 idoprz

Ahh shoot my apologies! Totally skimmed over the username without looking closely 🤦🏻‍♂️.

But also got it, thanks for clarifying!

hawkticehurst avatar Oct 29 '21 16:10 hawkticehurst