Scholarly web components for interactive UI elements
A sliding toggle switch with smooth animations, keyboard accessibility, and form integration.
An informational popup that appears on hover or click, with support for custom icons and pinning.
Hover over the icon to see information
Click to pin this popup open
Click the icon again or click outside to unpin. This is useful for content that users might want to reference while interacting with other parts of the page.
This popup only responds to clicks
const x = 42;<!-- Combined bundle (both components) --> <script src="dist/toggle-popup.min.js"></script> <!-- Or individual components --> <script src="dist/toggle-switch.min.js"></script> <script src="dist/popup-info.min.js"></script>
<toggle-switch
label-left="Off"
label-right="On"
checked>
</toggle-switch>
<script>
const toggle = document.querySelector('toggle-switch');
toggle.addEventListener('change', (e) => {
console.log('Checked:', e.detail.checked);
});
</script>
<popup-info pinnable emoji="💡">
<strong>Pro tip:</strong> Click to pin this popup!
</popup-info>
<script>
const popup = document.querySelector('popup-info');
popup.addEventListener('popup-open', () => console.log('Opened'));
popup.addEventListener('popup-close', () => console.log('Closed'));
</script>