addons/components/README.mdblame
View source
b69ab311# addons/components/
b69ab312
b69ab313This directory contains a component library used internally by ISL, in an isolated shareable location.
b69ab314
b69ab315This 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.
b69ab316It is visually almost identical, since it was used to migrate away from the toolkit without requiring restyling.
b69ab317
b69ab318## Usage
b69ab319
b69ab3110This package is currently not published to npm, and must be copied or referenced directly.
b69ab3111
b69ab3112There's a simple component explorer available by running `npm run start` in this directory.
b69ab3113
b69ab3114Alternatively, search ../isl/ for usage examples.
b69ab3115
b69ab3116## Differences from vscode-webivew-ui-toolkit
b69ab3117
b69ab3118- requires react & stylex
b69ab3119- does not use HTML Custom Elements / Shadow root
b69ab3120- includes default light and dark theme variable definitions as an optional import. But still uses vscode theme variables when used inside of vscode.
b69ab3121- component APIs are changed to fit react usage a bit more directly
b69ab3122- some component designs are tweaked, like `<Button icon>` has a border and background color by default
b69ab3123- added some components
b69ab3124
b69ab3125## Components
b69ab3126
b69ab3127Like vscode-webview-ui-toolkit:
b69ab3128
b69ab3129- **Badge**: usually used for numbers
b69ab3130- **Button**
b69ab3131- **Checkbox**
b69ab3132- **Dropdown**: `<select>`
b69ab3133- **Divider**: `<hr>`
b69ab3134- **Panels**
b69ab3135- **Radio**
b69ab3136- **LinkButton**: `<a>`
b69ab3137- **Tag**: used for text. Unlike the toolkit, this is not forced to be uppercase
b69ab3138- **TextArea**: `<textarea>` for long-form text
b69ab3139- **TextField**: `<input type="text">` for one line of text
b69ab3140
b69ab3141Additional components:
b69ab3142
b69ab3143- **Banner**: informational banner
b69ab3144- **ButtonDropdown**: `<button>` with a dropdown to change which action to take
b69ab3145- **ButtonGroup**: add multiple button children to meld them into a side-by-side button
b69ab3146- **ErrorNotice**: Used to show an error message + stack trace
b69ab3147- **Flex**: Simple flexbox containers so you don't need to repeat `display: flex` all over the place
b69ab3148- **Icon**: codicon exposed as a component
b69ab3149- **Kbd**: looks like a keyboard key, used for keyboard shortcuts
b69ab3150- **Subtle**: Simply makes text smaller and lighter, to use as an informational byline that is less intense than normal text
b69ab3151- **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.
b69ab3152- **Typeahead**
b69ab3153- **ViewportOverlay**: Another top level wrapper used to add tooltips and modals.
b69ab3154- **Tooltip**: Tooltips that can appear on hover or click