UI › LAYER
SINCE 1.0.0

Layer

Minimal popup API with Promise result, plus SweetAlert-like SVG icon animations powered by xjs.draw() / spring easing.

Quick demo

Open popups
JavaScript
HTML
CSS
// SweetAlert-like icons (SVG + draw)
xjs.layer({ title: 'Success', text: 'Saved!', icon: 'success' });
xjs.layer({ title: 'Error', text: 'Something went wrong', icon: 'error' });

// Confirm flow
xjs.layer({
  title: 'Delete item?',
  text: 'This action cannot be undone.',
  icon: 'warning',
  showCancelButton: true
}).then((res) => {
  if (res.isConfirmed) xjs.layer({ title: 'Deleted', icon: 'success' });
});
<button class="btn success">Success</button>
<button class="btn error">Error</button>
<button class="btn warning">Warning</button>
<button class="btn info">Info</button>
<button class="btn">Confirm</button>
/* This page's button styles are local.
   Layer's own CSS is injected by layer.js */
功能说明:Layer 的 icon 现在是内联 SVG(ring + mark),打开弹窗时会自动触发描边动画;弹窗支持 ESC 关闭(可用 closeOnEsc:false 关闭)。
Tip: try pressing ESC while the popup is open.
icon
success | error | warning | info
iconAnimation
true (default)
popupAnimation
true (default)
closeOnEsc
true (default)
Previous
Next