« E2 - Collapsible Panel Demo

Interactive demonstration of the <e2-collapsible-panel> element

Vertical Panels (Default)

Panels that collapse/expand vertically, useful for sidebars and tool panels.

Properties Panel

Object Properties

Position: (100, 50)

Size: 200x150

Rotation: 45°

  • Visible: Yes
  • Locked: No
  • Layer: Foreground
Layers Panel

Layer Structure

  • Background Layer
  • Main Content
  • UI Elements
  • Debug Overlay

Horizontal Panels

Panels that collapse/expand horizontally, useful for toolboxes and inspector panels.

Tools

Drawing Tools

Select your tool:

  • Brush
  • Eraser
  • Fill Bucket
  • Text Tool
Colors

Color Palette

Primary: #ff0000

Secondary: #00ff00

Background: #ffffff

Resizable Panels

Panels with resizable edges. Drag the thick borders to resize!
Note: Vertical panels can only be resized vertically (height), horizontal panels can only be resized horizontally (width).

Resizable Vertical Panel

Resize Me!

Drag the thick bottom border to resize this panel vertically.

Min height: 150px

Max height: 400px

Try collapsing and expanding to see size persistence!

Resizable Horizontal Panel

Resize Me Too!

Drag the thick right border to resize this panel horizontally.

Min width: 200px, Max width: 500px

Multi-Edge Resizable Panel

Multi-Edge Resize Panel

This vertical panel can be resized vertically on both edges:

  • Top edge (resize vertically)
  • Bottom edge (resize vertically)

Note: Vertical panels can only be resized vertically (height), horizontal panels can only be resized horizontally (width).

Dark Theme

Dark Theme Panel

Dark Mode Content

This panel uses the dark theme.

Perfect for night-time editing sessions!

Copy-Paste Examples

Ready-to-use code snippets for your projects:

Basic Vertical Panel HTML:

<!-- Load E2 Library -->
<script src="path/to/e2.min.js"></script>

<!-- Basic Collapsible Panel -->
<e2-collapsible-panel orientation="vertical">
  <span slot="title">Panel Title</span>
  <div>
    <h4>Content Title</h4>
    <p>Your panel content goes here...</p>
    <ul>
      <li>List item 1</li>
      <li>List item 2</li>
    </ul>
  </div>
</e2-collapsible-panel>

Resizable Panel:

<!-- Resizable panel with size constraints -->
<e2-collapsible-panel
  orientation="vertical"
  resize-right
  resize-bottom
  min-width="200"
  max-width="500"
  min-height="150"
  max-height="400"
  style="width: 300px; height: 200px;">
  <span slot="title">Resizable Panel</span>
  <div>Drag the thick borders to resize!</div>
</e2-collapsible-panel>

JavaScript Control:

// Get panel reference
const panel = document.querySelector('e2-collapsible-panel');

// Control programmatically
panel.expand();    // Expand panel
panel.collapse();  // Collapse panel
panel.toggle();    // Toggle state

// Configure resize options
panel.resizeRight = true;
panel.resizeBottom = true;
panel.minWidth = 200;
panel.maxWidth = 500;

// Listen for events
panel.addEventListener('collapsible-panel-toggle', (event) => {
  console.log('Panel toggled:', event.detail);
});

panel.addEventListener('collapsible-panel-resize-start', (event) => {
  console.log('Resize started:', event.detail);
});

panel.addEventListener('collapsible-panel-resize-end', (event) => {
  console.log('Resize ended:', event.detail);
});

// Change properties
panel.orientation = "horizontal";

Programmatic Controls


Output

Panel events will appear here: