Skip to content

Commit 66b8bbf

Browse files
Add more framework samples (microsoft#80)
Description of changes Adds hello world sample extensions for Svelte, Vue, Angular, and SolidJS-based webview extensions. Also includes some minor clean-up to the React samples and reorganizes the overall repo structure.
1 parent 2284469 commit 66b8bbf

File tree

214 files changed

+46201
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+46201
-42
lines changed

README.md

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,29 @@ Follow the instructions in the `README` file of the desired sample extension.
1414

1515
### Default samples
1616

17-
A set of sample extensions using vanilla HTML, CSS, and JavaScript to render the webview UI.
17+
A set of sample extensions using vanilla HTML, CSS, and JavaScript/TypeScript to render the webview UI and demonstrate various VS Code APIs.
1818

19-
| Sample extension | Description |
20-
| ------------------------------------------------ | --------------------------------------------------------------------------------- |
21-
| [component-gallery](./default/component-gallery) | Demonstrates every component in the Webview UI Toolkit. |
22-
| [hello-world](./default/hello-world) | A basic hello-world starter extension. |
23-
| [notepad](./default/notepad) | A simple notetaking extension that leverages the VS Code TreeView API. |
24-
| [weather-webview](./default/weather-webview) | Demonstrates the toolkit being used within a webview view – i.e., Visual Studio Code sidebar. |
25-
26-
### React samples
27-
28-
A set of sample extensions using React to render the webview UI.
29-
30-
| Sample extension | Description |
31-
| ---------------------------------------------| --------------------------------------------------------------------- |
32-
| [hello-world-cra](./react/hello-world-cra) | A basic hello-world starter extension using React + Create React App. |
33-
| [hello-world-vite](./react/hello-world-vite) | A basic hello-world starter extension using React + Vite. |
34-
35-
### Svelte samples
36-
37-
A set of sample extensions using Svelte to render the webview UI.
19+
Don't see a demonstration for your desired use case, VS Code API, etc.? Open an issue and request it.
3820

39-
| Sample extension | Description |
40-
| -----------------| ----------- |
41-
| _Coming soon_ | |
42-
43-
### Vue samples
44-
45-
A set of sample extensions using Vue to render the webview UI.
46-
47-
| Sample extension | Description |
48-
| -----------------| ----------- |
49-
| _Coming soon_ | |
50-
51-
### Angular samples
52-
53-
A set of sample extensions using Angular to render the webview UI.
21+
| Sample extension | Description |
22+
| ------------------------------------------------ | --------------------------------------------------------------------------------------------- |
23+
| [component-gallery](./default/component-gallery) | Demonstrates every component in the Webview UI Toolkit. |
24+
| [hello-world](./default/hello-world) | A basic hello-world starter extension. |
25+
| [notepad](./default/notepad) | A simple notetaking extension that leverages the VS Code TreeView API. |
26+
| [weather-webview](./default/weather-webview) | Demonstrates the toolkit being used within a webview view – i.e., Visual Studio Code sidebar. |
5427

55-
| Sample extension | Description |
56-
| -----------------| ----------- |
57-
| _Coming soon_ | |
28+
### Framework samples
5829

59-
### Other samples
30+
A set of sample extensions that demonstrate how to use various web frameworks to render the webview UI.
6031

61-
Don't see a demonstration for your desired framework, API, use case, etc.? Open an issue and request it.
32+
| Sample extension | Description |
33+
| --------------------------------------------------------------| --------------------------------------------------------------------- |
34+
| [hello-world-angular](./frameworks/hello-world-angular) | A basic hello-world starter extension using Angular. |
35+
| [hello-world-react-cra](./frameworks/hello-world-react-cra) | A basic hello-world starter extension using React + Create React App. |
36+
| [hello-world-react-vite](./frameworks/hello-world-react-vite) | A basic hello-world starter extension using React + Vite. |
37+
| [hello-world-solidjs](./frameworks/hello-world-solidjs) | A basic hello-world starter extension using SolidJS. |
38+
| [hello-world-svelte](./frameworks/hello-world-svelte) | A basic hello-world starter extension using Svelte. |
39+
| [hello-world-vue](./frameworks/hello-world-vue) | A basic hello-world starter extension using Vue. |
6240

6341
## Contributing
6442

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "es5",
10+
"bracketSpacing": true,
11+
"jsxBracketSameLine": true,
12+
"arrowParens": "always"
13+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Hello World (Angular)
2+
3+
This is an implementation of the default [Hello World](https://github.com/microsoft/vscode-webview-ui-toolkit-samples/tree/main/default/hello-world) sample extension that demonstrates how to set up and use a [Angular](https://angular.io/) + [Webview UI Toolkit](https://github.com/microsoft/vscode-webview-ui-toolkit) webview extension.
4+
5+
![A screenshot of the sample extension.](./assets/hello-world-screenshot.png)
6+
7+
## Documentation
8+
9+
For a deeper dive into how this sample works, read the guides below.
10+
11+
- [Extension structure](./docs/extension-structure.md)
12+
- [Extension commands](./docs/extension-commands.md)
13+
- [Extension development cycle](./docs/extension-development-cycle.md)
14+
15+
## Run The Sample
16+
17+
```bash
18+
# Copy sample extension locally
19+
npx degit microsoft/vscode-webview-ui-toolkit-samples/frameworks/hello-world-angular hello-world
20+
21+
# Navigate into sample directory
22+
cd hello-world
23+
24+
# Install dependencies for both the extension and webview UI source code
25+
npm run install:all
26+
27+
# Build webview UI source code
28+
npm run build:webview
29+
30+
# Open sample in VS Code
31+
code .
32+
```
33+
34+
Once the sample is open inside VS Code you can run the extension by doing the following:
35+
36+
1. Press `F5` to open a new Extension Development Host window
37+
2. Inside the host window, open the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and type `Hello World (Angular): Show`

0 commit comments

Comments
 (0)