Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the Webview UI Toolkit for Visual Studio Code for webview UI #2661

Closed
daviddossett opened this issue Oct 18, 2021 · 19 comments · Fixed by #3647
Closed

Use the Webview UI Toolkit for Visual Studio Code for webview UI #2661

daviddossett opened this issue Oct 18, 2021 · 19 comments · Fixed by #3647
Assignees
Labels
TA:E2E Team Area: E2E TA:PM PM investigation area
Milestone

Comments

@daviddossett
Copy link

daviddossett commented Oct 18, 2021

Proposal

Hi all! 👋

As of today, some of the webview UI (some examples pictured below) in the Teams Toolkit extension appears to users as visually and functionally distant from the native VS Code UI itself.

Now that the Webview UI Toolkit for Visual Studio Code has been released, I think some of the webviews in the extension could benefit from swapping out their custom components for those provided by the toolkit. Specifically, buttons, links, and tags as a starting point. There may be other views I haven't come across yet.

You can view the components in a Storybook environment here.

References

While we don't currently provide the cards themselves in the Webview UI Toolkit, the tags and buttons could be replaced in this view:

CleanShot 2021-10-18 at 16 07 41@2x

Here, while it probably makes sense to adopt the new getting started API from VS Code itself, these views could also use buttons and links to at minimum solve the issues surrounding behavior, theming, and more in the near term:

CleanShot 2021-10-18 at 16 17 43@2x

cc @jaeyonglee8687 @hawkticehurst @misolori

@ghost
Copy link

ghost commented Oct 18, 2021

Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.

@adashen adashen added the TA:PM PM investigation area label Oct 20, 2021
@jaeyonglee8687
Copy link

Following on this topic, and ideally, we adapt the VSCode Getting started API to replace our own webview. Rather than changing it incrementally, it would make sense to change the quickstart to the given API at once when we update the content of it.

@jaeyonglee8687
Copy link

@HuihuiWu-Microsoft
Copy link
Contributor

@jaeyonglee8687 @1openwindow For the getting started page, let's adapt the VSCode Getting started API later. For the sample gallery page, I can replace the buttons and tags with Webview UI Toolkit first.

@HuihuiWu-Microsoft
Copy link
Contributor

Currently VSC webview UI toolkit doesn't support React, there's already a pr raised microsoft/vscode-webview-ui-toolkit#300. Will update once supported

@jaeyonglee8687
Copy link

@daviddossett @hawkticehurst @misolori please check Huihui's previous comment that the toolkit doesn't support React, and this is something critical blocking us to implement. Do you have any plan to support React in the toolkit?

@hawkticehurst
Copy link

@jaeyonglee8687 @HuihuiWu-Microsoft Yes, we are currently working on it right now!

We currently have an in-progress PR that will expose/publish a set of toolkit React components that can be easily imported and used in React-based webview extensions.

We are also working on a sample extension that will demonstrate the usage of these components and generally how to configure a React-based webview extension (although I expect this latter part will be less important to all of you).

In both, cases we're almost done with this work but are just waiting on an upstream issue to be resolved that is blocking us.

So with all that said, we hope to have this work finished and published by early January since the holidays are coming up and myself and others will be OOF for a few weeks.

@jaeyonglee8687
Copy link

jaeyonglee8687 commented Dec 10, 2021 via email

@HuihuiWu-Microsoft
Copy link
Contributor

Hi @hawkticehurst, I see the blocking issue you mentioned has been closed. The PR which will support React framework is still in progress. From the comments in the PR, I guess you're working on the typescript issue. Is it possible to estimate how long it will takes before getting this ready? Since we're going to improve the experience of sample gallery, we'd like to include the webview UI toolkit in the work if the time is ok or maybe we can do the enhancement first and update later when React support is ready.

@hawkticehurst
Copy link

hawkticehurst commented Jan 11, 2022

Hey @HuihuiWu-Microsoft, yes the blocking issue has been closed now, so we're good to go on that front! Also, with that work finished, support for React is technically complete now!

This PR simply represents an effort to make the process of using/importing React-based toolkit components easier for extension authors but does not represent a blocker on being able to use the toolkit in React itself.

This comment provides a summary of how you can use the toolkit in React if you really want to get started on the sample gallery experience (and then once the PR I mentioned above is finished it should be pretty simple to switch over). In fact, this comment is basically what the PR contains, so it's literally just a case of us doing the work of wrapping toolkit components instead of you doing the work––but again doesn't represent an actual issue with being able to use the toolkit in React.

Also, the typescript issue is the result of an issue that lives two repos upstream from the toolkit, so I don't have a lot of insights into how long it will take for that problem to be fixed.

However, this shouldn't actually be a problem for your extension because, as far as I can tell, it looks like you're using TypeScript v4.2.4 and the problem mentioned in the FAST issue only applies to repos using any TS version greater than v4.3.5. Also even if you're extension did move to a more recent version of TS there is a stop-gap solution for fixing the problem.

I hope that all makes sense and helps clear things up a bit. If you have any other questions I'd be more than happy to answer them!

@ghost ghost added the needs attention This issue needs the attention of a contributor. label Jan 11, 2022
@HuihuiWu-Microsoft
Copy link
Contributor

Hi @hawkticehurst , thanks for your quick reply and that's much clear. So I'll need to wrap the used React component in our project using fast-react-wrapper and maybe update later once the wrapping is done in webview ui toolkit layer. I think that works for us. I'll have a try with the quick guide and let you know if any problems. Thanks!

@hawkticehurst
Copy link

Of course! Happy it was helpful.

Also, yes that is correct, you can manually wrap web components now and then update them later when we finish our PR.

Finally, sounds great, please do let us know if you run into any issues!

@adashen adashen added this to the Backlog milestone Jan 13, 2022
@HuihuiWu-Microsoft
Copy link
Contributor

For our existing sample gallery design, I've adapted vscode Webview UI toolkit in this pr. In later sample gallery enhancement, I'll also leverage the toolkit for existing controls.

@MSFT-yiz MSFT-yiz modified the milestones: Backlog, CY22-1.1 Jan 13, 2022
@adashen adashen added TA:E2E Team Area: E2E and removed needs attention This issue needs the attention of a contributor. labels Jan 13, 2022
@daviddossett
Copy link
Author

Great to hear @HuihuiWu-Microsoft! Do let us know if you have any feedback along the way 🙏

@ghost ghost added the needs attention This issue needs the attention of a contributor. label Jan 13, 2022
@hawkticehurst
Copy link

+1 to what @daviddossett said!

@adashen adashen removed the needs attention This issue needs the attention of a contributor. label Jan 14, 2022
@hawkticehurst
Copy link

@HuihuiWu-Microsoft Hey! Just wanted to give a heads up that as of v0.9.0 we finally shipped the React components if you would like to use them.

You should be able to remove the file that wraps components (and uninstall the fast-react-wrapper package) and instead replace it with import statements along these lines and it should just work:

import { VSCodeButton, VSCodeDropdown } from '@vscode/webview-ui-toolkit/react';

Let me know if you have any questions!

@ghost ghost added the needs attention This issue needs the attention of a contributor. label Jan 26, 2022
@HuihuiWu-Microsoft
Copy link
Contributor

Thanks @hawkticehurst! Good news to hear. I'll try latest version and cleanup the codes to import the React components directly. Will let you know if I meet any problem.

@hawkticehurst
Copy link

Sounds great!

@adashen adashen removed the needs attention This issue needs the attention of a contributor. label Jan 27, 2022
@adashen
Copy link
Contributor

adashen commented Jan 27, 2022

close as solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TA:E2E Team Area: E2E TA:PM PM investigation area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants