Skip to content

Commit b95bf9c

Browse files
committed
Merge remote-tracking branch 'origin/main' into docs-new
2 parents 89c0819 + ef20ad0 commit b95bf9c

File tree

7 files changed

+106
-1
lines changed

7 files changed

+106
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ pnpm-debug.log*
2323

2424
.vscode
2525
!.vscode/extensions.json
26-
!.vscode/launch.json
26+
!.vscode/launch.json

public/googlede42a4469fcf47eb.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-site-verification: googlede42a4469fcf47eb.html
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<style>
2+
.css-part-example::part(body) {
3+
overflow: visible;
4+
}
5+
6+
.css-part-example p:last-child {
7+
margin-bottom: 0;
8+
}
9+
</style>
10+
11+
<vscode-collapsible title="Customized CSS part example" class="css-part-example" open>
12+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
13+
<vscode-single-select>
14+
<vscode-option>Lorem</vscode-option>
15+
<vscode-option>Ipsum</vscode-option>
16+
<vscode-option>Dolor</vscode-option>
17+
<vscode-option>Sit</vscode-option>
18+
<vscode-option>Et</vscode-option>
19+
<vscode-option>Amur</vscode-option>
20+
<vscode-option>Sadispcing</vscode-option>
21+
</vscode-single-select>
22+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
23+
</vscode-collapsible>

src/components/examples/collapsible/Imports.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import "@vscode-elements/elements/dist/vscode-badge/index.js";
44
import "@vscode-elements/elements/dist/vscode-scrollable/index.js";
55
import "@vscode-elements/elements/dist/vscode-tree/index.js";
6+
import "@vscode-elements/elements/dist/vscode-single-select/index.js";
7+
import "@vscode-elements/elements/dist/vscode-option/index.js";
68
import "@vscode-elements/elements/dist/vscode-collapsible/index.js";
79
</script>
810

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<vscode-collapsible title="Dispatch toggle event" id="toggle-event-example">
2+
<p>Test content</p>
3+
</vscode-collapsible>
4+
5+
<script>
6+
const el = document.querySelector("#toggle-event-example");
7+
8+
el?.addEventListener("vsc-collapsible-toggle", (ev) => {
9+
console.log(ev);
10+
});
11+
</script>

src/content/docs/components/collapsible.mdx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import BasicExample from "@components/examples/collapsible/BasicExample.astro";
1010
import ActionsExample from "@components/examples/collapsible/ActionsExample.astro";
1111
import DecorationsExample from "@components/examples/collapsible/DecorationsExample.astro";
1212
import ScrollableExample from "@components/examples/collapsible/ScrollableExample.astro";
13+
import ToggleExample from "@components/examples/collapsible/ToggleExample.astro";
14+
import CssBodyPartExample from "@components/examples/collapsible/CssBodyPartExample.astro";
1315

1416
<Imports />
1517
<PageSwitcher />
@@ -37,6 +39,30 @@ import ScrollableExample from "@components/examples/collapsible/ScrollableExampl
3739
</Fragment>
3840
</Demo>
3941

42+
## Toggle event
43+
44+
A custom event is dispatched when the visibility of content changes.
45+
46+
<Demo>
47+
<ToggleExample />
48+
<Fragment slot="html">
49+
```html
50+
<vscode-collapsible title="Dispatch toggle event" id="toggle-event-example">
51+
<p>Test content</p>
52+
</vscode-collapsible>
53+
```
54+
</Fragment>
55+
<Fragment slot="js">
56+
```javascript
57+
const el = document.querySelector("#toggle-event-example");
58+
59+
el.addEventListener("vsc-collapsible-toggle", (ev) => {
60+
console.log(ev);
61+
});
62+
```
63+
</Fragment>
64+
</Demo>
65+
4066
## Actions
4167

4268
Clickable action icons. Please review the developer console for logged messages. These icons are
@@ -138,6 +164,43 @@ Elements in the `decorations` slot are always visible, in contrast to the `actio
138164
</Fragment>
139165
</Demo>
140166

167+
## Overflown content
168+
169+
The overflown content of the Collapsible component is hidden by default. Sometimes, this behavior
170+
can be problematic. In such cases, it is useful that the Collapsible body is customizable.
171+
172+
<Demo>
173+
<CssBodyPartExample />
174+
<Fragment slot="html">
175+
```html
176+
<vscode-collapsible title="Customized CSS part example" class="css-part-example" open>
177+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
178+
<vscode-single-select>
179+
<vscode-option>Lorem</vscode-option>
180+
<vscode-option>Ipsum</vscode-option>
181+
<vscode-option>Dolor</vscode-option>
182+
<vscode-option>Sit</vscode-option>
183+
<vscode-option>Et</vscode-option>
184+
<vscode-option>Amur</vscode-option>
185+
<vscode-option>Sadispcing</vscode-option>
186+
</vscode-single-select>
187+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
188+
</vscode-collapsible>
189+
```
190+
</Fragment>
191+
<Fragment slot="css">
192+
```css
193+
.css-part-example::part(body) {
194+
overflow: visible;
195+
}
196+
197+
.css-part-example p:last-child {
198+
margin-bottom: 0;
199+
}
200+
```
201+
</Fragment>
202+
</Demo>
203+
141204
## Displaying large amounts of data
142205

143206
Long content can be managed by the [Scrollable](/components/scrollable) component.

src/content/docs/components/icon.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ import Imports from "@components/examples/icon/Imports.astro";
2222
```html
2323
<!--
2424
Download codicons from https://github.com/microsoft/vscode-codicons
25+
26+
Note the required `id` on the link element!
27+
To use web fonts in web components, the component needs to include
28+
the font stylesheet in addition to the page. This id serves as a lookup so
29+
the icon component can automatically create and insert it's own link tag.
2530
-->
2631
<link
2732
rel="stylesheet"

0 commit comments

Comments
 (0)