Skip to content

Commit 6d8fe60

Browse files
committed
Add Collapsible css part example
1 parent 2ebd942 commit 6d8fe60

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed
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
@@ -6,5 +6,7 @@
66
import "@vscode-elements/elements/dist/vscode-badge/index.js";
77
import "@vscode-elements/elements/dist/vscode-scrollable/index.js";
88
import "@vscode-elements/elements/dist/vscode-tree/index.js";
9+
import "@vscode-elements/elements/dist/vscode-single-select/index.js";
10+
import "@vscode-elements/elements/dist/vscode-option/index.js";
911
import "@vscode-elements/elements/dist/vscode-collapsible/index.js";
1012
</script>

src/content/components/collapsible.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ActionsExample from "@components/examples/collapsible/ActionsExample.astr
88
import DecorationsExample from "@components/examples/collapsible/DecorationsExample.astro";
99
import ScrollableExample from "@components/examples/collapsible/ScrollableExample.astro";
1010
import ToggleExample from "@components/examples/collapsible/ToggleExample.astro";
11+
import CssBodyPartExample from "@components/examples/collapsible/CssBodyPartExample.astro";
1112
import Imports from "@components/examples/collapsible/Imports.astro";
1213

1314
<Imports />
@@ -160,6 +161,43 @@ Elements in the `decorations` slot are always visible, in contrast to the `actio
160161
</Fragment>
161162
</Demo>
162163

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

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

0 commit comments

Comments
 (0)