| b69ab31 | | | 1 | # addons/components/ |
| b69ab31 | | | 2 | |
| b69ab31 | | | 3 | This directory contains a component library used internally by ISL, in an isolated shareable location. |
| b69ab31 | | | 4 | |
| b69ab31 | | | 5 | This library is (visually) heavily based on the [VS Code Webview UI Toolkit](https://github.com/microsoft/vscode-webview-ui-toolkit), but slightly streamlined for react usage and doesn't share any code. |
| b69ab31 | | | 6 | It is visually almost identical, since it was used to migrate away from the toolkit without requiring restyling. |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | ## Usage |
| b69ab31 | | | 9 | |
| b69ab31 | | | 10 | This package is currently not published to npm, and must be copied or referenced directly. |
| b69ab31 | | | 11 | |
| b69ab31 | | | 12 | There's a simple component explorer available by running `npm run start` in this directory. |
| b69ab31 | | | 13 | |
| b69ab31 | | | 14 | Alternatively, search ../isl/ for usage examples. |
| b69ab31 | | | 15 | |
| b69ab31 | | | 16 | ## Differences from vscode-webivew-ui-toolkit |
| b69ab31 | | | 17 | |
| b69ab31 | | | 18 | - requires react & stylex |
| b69ab31 | | | 19 | - does not use HTML Custom Elements / Shadow root |
| b69ab31 | | | 20 | - includes default light and dark theme variable definitions as an optional import. But still uses vscode theme variables when used inside of vscode. |
| b69ab31 | | | 21 | - component APIs are changed to fit react usage a bit more directly |
| b69ab31 | | | 22 | - some component designs are tweaked, like `<Button icon>` has a border and background color by default |
| b69ab31 | | | 23 | - added some components |
| b69ab31 | | | 24 | |
| b69ab31 | | | 25 | ## Components |
| b69ab31 | | | 26 | |
| b69ab31 | | | 27 | Like vscode-webview-ui-toolkit: |
| b69ab31 | | | 28 | |
| b69ab31 | | | 29 | - **Badge**: usually used for numbers |
| b69ab31 | | | 30 | - **Button** |
| b69ab31 | | | 31 | - **Checkbox** |
| b69ab31 | | | 32 | - **Dropdown**: `<select>` |
| b69ab31 | | | 33 | - **Divider**: `<hr>` |
| b69ab31 | | | 34 | - **Panels** |
| b69ab31 | | | 35 | - **Radio** |
| b69ab31 | | | 36 | - **LinkButton**: `<a>` |
| b69ab31 | | | 37 | - **Tag**: used for text. Unlike the toolkit, this is not forced to be uppercase |
| b69ab31 | | | 38 | - **TextArea**: `<textarea>` for long-form text |
| b69ab31 | | | 39 | - **TextField**: `<input type="text">` for one line of text |
| b69ab31 | | | 40 | |
| b69ab31 | | | 41 | Additional components: |
| b69ab31 | | | 42 | |
| b69ab31 | | | 43 | - **Banner**: informational banner |
| b69ab31 | | | 44 | - **ButtonDropdown**: `<button>` with a dropdown to change which action to take |
| b69ab31 | | | 45 | - **ButtonGroup**: add multiple button children to meld them into a side-by-side button |
| b69ab31 | | | 46 | - **ErrorNotice**: Used to show an error message + stack trace |
| b69ab31 | | | 47 | - **Flex**: Simple flexbox containers so you don't need to repeat `display: flex` all over the place |
| b69ab31 | | | 48 | - **Icon**: codicon exposed as a component |
| b69ab31 | | | 49 | - **Kbd**: looks like a keyboard key, used for keyboard shortcuts |
| b69ab31 | | | 50 | - **Subtle**: Simply makes text smaller and lighter, to use as an informational byline that is less intense than normal text |
| b69ab31 | | | 51 | - **ThemedComponentRoot**: Unlike the toolkit, we require this parent component at the root of the tree to provide theme variables. This is also how you set the current theme if being used outside of VS Code. |
| b69ab31 | | | 52 | - **Typeahead** |
| b69ab31 | | | 53 | - **ViewportOverlay**: Another top level wrapper used to add tooltips and modals. |
| b69ab31 | | | 54 | - **Tooltip**: Tooltips that can appear on hover or click |