Skip to content

sv-splitter-panel

sv-splitter-panel is one panel of an sv-splitter, with the handle that follows it.

Usage

A panel lives directly inside an sv-splitter, and every visible panel but the last has a handle.

Put padding and dir on the content of a panel instead of on the panel itself, which keeps the sizes and the handle in place.

Collapsed state

Hide what does not fit a rail with the --collapsed state:

sv-splitter-panel:state(--collapsed) .label {
display: none;
}

Structure

divcontent
slotdefault - Your content
divhandle
slothandle
spangrip - Default grip

API References

Methods

collapse()

Collapses the panel, skipping the animation when isInstant is true.

expand()

Expands the panel, skipping the animation when isInstant is true.

toggle()

Collapses or expands the panel, skipping the animation when isInstant is true.

Properties

size

The size of the panel, as a CSS length. A percentage scales with the splitter, and any other length stays the same when the splitter resizes. A value with no unit is a percentage. Without a size, the panel shares the percentage that is left. Setting it animates the panel.

min

The smallest size, as a CSS length. A value with no unit is a percentage.

max

The largest size, as a CSS length. A value with no unit is a percentage.

collapsedSize

The size while collapsed, as a CSS length. A value with no unit is a percentage. With a value other than 0, the content stays visible while collapsed, like a rail of icons.

collapsible

Whether the user can collapse the panel with Home, Enter, or a drag past the midpoint of collapsedSize and min. Code can always collapse it.

collapsed

Whether the panel is collapsed. The panel keeps size, and goes back to it when it expands. Setting it animates the panel.

noResize

Whether the user cannot drag the handles on both sides of the panel. A drag on another handle does not change the panel.

Attributes

"hidden"

The native hidden attribute, which leaves the panel out of the layout and out of sizes.

"size"

The size at the start, and the size that reset() restores.

"min"

The smallest size, as a CSS length. A value with no unit is a percentage.

"max"

The largest size, as a CSS length. A value with no unit is a percentage.

"collapsed-size"

The size while collapsed, as a CSS length. A value with no unit is a percentage. With a value other than 0, the content stays visible while collapsed, like a rail of icons.

"collapsible"

Whether the user can collapse the panel with Home, Enter, or a drag past the midpoint of collapsedSize and min. Code can always collapse it.

"collapsed"

Whether the panel is collapsed. The panel keeps size, and goes back to it when it expands. Setting it animates the panel.

"no-resize"

Whether the user cannot drag the handles on both sides of the panel. A drag on another handle does not change the panel.

Events

collapsedchange

Fired after collapsed changes, whether by the user or from code.

transitionfinish

Fired when the animation of a collapsed change ends, or right away when nothing animates.

Slots

Default

The content of the panel.

handle

Content in place of the grip on the handle, hidden from assistive technology.

CSS Properties

--sv-splitter-grip-sz

Length of the grip along the line.

--sv-splitter-ln-clr

Color of the line.

--sv-splitter-grip-clr

Color of the grip.

--sv-splitter-dur

Duration of the size animation.

--sv-splitter-ease

Easing of the size animation.

--sv-splitter-handle-thickness

Thickness of the line between the panels. Set it on sv-splitter, since it also sets the gap between them.

--sv-splitter-hit-sz

Size of the area that takes a drag, across the line.

--sv-splitter-active-ln-clr

Color of the line while it is hovered, focused, or dragged.

CSS Parts

::part(content)

The box around the content, which scrolls when the content is too large.

::part(handle)

The focusable separator that the user drags between this panel and the next one.

::part(grip)

The mark in the middle of the handle.

CSS States

:state(--collapsed)

The panel is collapsed.

:state(--vertical)

The panel is in a vertical splitter.