KANTO DS v1.12.0
Customise

Theme

Accent

Font

Corners

Density

Text size

Reset to Kanto
Overlays

kt-side-panel

GitHub Copy link

A drawer sliding in from the right, for viewing or editing one record without losing the list behind it.

Preview

Open the panel

Focus is trapped, Escape closes, the page behind is inert.

A drawer sliding in from the right, for viewing or editing one record without losing the list behind it.

<kt-side-panel open eyebrow="Details" heading="Entity 4812"> <kt-label-input label="Nom"><kt-input value="Entity 4812"></kt-input></kt-label-input> <kt-button slot="footer" full-width>Save</kt-button> </kt-side-panel>

Built on <dialog>

showModal() is doing real work here. It puts the panel in the top layer, above every stacking context — which no z-index can guarantee — traps focus inside it, makes the rest of the page inert, and handles Escape.

The fixed-position div this replaces did none of that: tabbing walked straight out of the panel into the page behind it.

Guarding unsaved changes

kt-close is cancelable. Cancel it and the panel stays open — including when Escape was what triggered it.

panel.addEventListener('kt-close', (e) => { if (!form.dirty) return; e.preventDefault(); confirmDialog.open = true; });

no-backdrop-close removes backdrop dismissal. Escape still works: a modal you cannot escape from is a trap, and cancelling kt-close is the right way to guard it.

Width

size sets it: small (308px, the default) for a record or a form, medium (480px), large (720px) for more than a form — a comparison, a configuration. On a phone it is never wider than the screen.

API

PropertyAttributeTypeDefault
openopenbooleanfalse
eyebroweyebrowstring'Details'
headingheadingstring''
sizesize'small' | 'medium' | 'large''small'
noBackdropCloseno-backdrop-closebooleanfalse
MethodDescription
requestClose()Fires kt-close, closes unless cancelled
EventDescription
kt-closeDismissal requested. Cancelable.
SlotDescription
defaultPanel body
footerPinned below the body