ElKit is a lightweight, modular JavaScript library designed to simplify UI component development. It offers customizable, accessible, and easy-to-integrate components like Modals, Accordions, Countdowns, and more.
- 🚀 Modular: Use only what you need.
- 🎯 Customizable: Configure components to match your design.
- ⚡ Lightweight: No unnecessary bloat.
- 🔧 Configurable: Supports detailed customization for each component.
You can include the CSS and JavaScript files for each component you need via CDN:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.css">
<script src="https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.min.js"></script>
import { ElKitModal } from 'https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.esm.js';
const ElKitModal = require('https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.cjs.js');
<script src="https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.umd.js"></script>
Since ElKit is modular, you can import only the components you need using the appropriate format:
import ElKitModal from 'https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.esm.js';
import ElKitAccordion from 'https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitAccordion/ElKitAccordion.esm.js';
import ElKitCountdown from 'https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitCountdown/ElKitCountdown.esm.js';
<script src="https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitModal/ElKitModal.umd.js"></script>
<script src="https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitAccordion/ElKitAccordion.umd.js"></script>
<script src="https://cdn.jsdelivr.net/gh/9itish/[email protected]/dist/ElKitCountdown/ElKitCountdown.umd.js"></script>
Create dynamic, customizable modals with backdrop and keyboard support.
- Change Modal content dynamically.
- Provide configuration options like max height, max width, and scrollable body.
- Specify which keys should close the modal when pressed.
- Open programatically or through data attributes on different elements.
- Easily change Modal appearance through CSS variables.
- Provide callbacks for closing and opening a Modal.
let firstModal = new ElKitModal({
sourceSelector: '.first-modal',
config: {
closingKeys: ["Escape"],
maxWidth: "600px",
scrollableBody: true
}
});
firstModal.open();
You can also use the data-el-modal
attribute to specify the modal that should popup when any element is clicked.
<button data-el-modal=".instruction-modal">See Instruction</button>
Build collapsible content sections with ease.
- Dynamically add or remove collapsible sections.
- Set some sections to be always open.
- Specify if some sections should be open at the beginning.
- Provide a callback that executes when a section closes or opens.
let firstAccordion = new ElKitAccordion({
selector: '#first-accordion',
collapseOthers: true,
openIndexes: [0],
alwaysOpen: [0]
});
firstAccordion.addQuestion('Why does my accordion open slower than my morning alarm?', 'Might be the 5000ms transition you added. Snail mode isn’t trendy yet.');
Add one or more countdown timers to a webpage.
- Either provide a duration or an end date for a timer.
- Start, pause, resume, or stop a timer on demand.
- Execute callback functions on starting, pausing, resuming, and stopping a timer.
- Callback functions also available for update and completion events.
- Be creative with the accompanying HTML, just provide us the selectors to update.
const countdown = new ElKitCountdown({
wrapperSelector: '#countdown-a',
timeSelectors: { d: '.days .cnt', hh: '.hours .cnt', mm: '.minutes .cnt', ss: '.seconds .cnt' },
endTime: new Date("2025/06/26")
});
countdown.start();
Each component supports a variety of options for complete customization. Check the Documentation for detailed configuration options.
Documentation to be done!
We welcome contributions! Please check out our Contributing Guide to get started.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or feedback, feel free to reach out via GitHub Issues.