NASjs v1.5.0

Modern, Lightweight UI Components - Zero Dependencies

jQuery UI Alternative SweetAlert Alternative ~8KB gzipped Dark Mode

Installation

Multiple ways to add NASjs to your project.

NPM / Yarn
npm install nasjs # or yarn add nasjs
CDN (Recommended)
<!-- CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nasjs@1.5.0/dist/nasjs.min.css"> <!-- JavaScript --> <script src="https://cdn.jsdelivr.net/npm/nasjs@1.5.0/dist/nasjs.min.js"></script>
GitHub Pages CDN
<link rel="stylesheet" href="https://naseemfasal.github.io/NASjs/dist/nasjs.min.css"> <script src="https://naseemfasal.github.io/NASjs/dist/nasjs.min.js"></script>

DatePicker jQuery UI Alternative

Modern, lightweight datepicker with advanced features like date ranges, disabled days, and API integration.

Basic DatePicker
Simple date selection with default settings.
Block Past Dates
Perfect for booking systems - only future dates available.
Block Future Dates
For historical data - only past dates available.
Next 30 Days Only
Date range using relative dates (+0 to +30).
Weekdays Only
Block weekends - perfect for business day selection.
Block Holidays
Disable specific dates like holidays.
// Basic usage NASjs.datePicker({ selector: '.my-datepicker' }); // Block past dates NASjs.datePicker({ selector: '.booking', blockPastDates: true }); // Date range NASjs.datePicker({ selector: '.range', minDate: '+0', maxDate: '+30' }); // Weekdays only NASjs.datePicker({ selector: '.weekdays', disabledDaysOfWeek: [0, 6] }); // Disable specific dates NASjs.datePicker({ selector: '.holidays', disabledDates: ['2024-12-25', '2025-01-01'] });

DatePicker Parameters

ParameterTypeDefaultDescription
selectorstring'.datepicker-input'CSS selector for inputs
formatstring'YYYY-MM-DD'Date format
minDatestring/DatenullMin date: '2024-01-01', '+0', '-30'
maxDatestring/DatenullMax date: '2024-12-31', '+365'
blockPastDatesbooleanfalseBlock dates before today
blockFutureDatesbooleanfalseBlock dates after today
disabledDatesarray[]Array of dates to disable
disabledDaysOfWeekarray[]Days to disable [0-6]
availableDatesarraynullOnly these dates selectable
onSelectfunctionnullCallback: (date, input) => {}

TimePicker

Simple, elegant time selection with customizable intervals and formats.

12-Hour Format
30-minute intervals with AM/PM.
24-Hour Format
1-hour intervals in 24-hour format.
15-Minute Intervals
More precise time selection.
NASjs.timePicker({ selector: '.timepicker', format: '12', // '12' or '24' interval: 30, // 15, 30, 60, 120 onSelect: (time, input) => console.log(time) });

Event Calendar NEW

Full-featured calendar with events, popups, and API integration. Click on events to see details!

// Basic usage with events NASjs.eventCalendar({ selector: '#calendar-demo', events: [ { id: 1, title: 'Team Meeting', date: '2024-12-15', color: '#3b82f6' }, { id: 2, title: 'Launch Day', date: '2024-12-20', color: '#10b981' } ], onEventClick: (event) => console.log(event) }); // Load from API NASjs.eventCalendar({ selector: '#calendar', eventsUrl: '/api/events' });
API JSON Format:
{ "events": [{ "id": 1, "title": "Meeting", "date": "2024-12-15", "description": "...", "color": "#3b82f6" }] }

Calendar Parameters

ParameterTypeDefaultDescription
selectorstring'#calendar'Container selector
eventsarray[]Array of event objects
eventsUrlstringnullAPI URL to fetch events
onEventClickfunctionnullEvent click callback
onDateClickfunctionnullDate click callback
popupFieldsarraynullCustom popup fields
renderEventPopupfunctionnullCustom popup renderer

Confirm Dialog SweetAlert Alternative

Beautiful confirmation dialogs - a lightweight alternative to SweetAlert.

NASjs.confirm({ title: 'Delete Item?', message: 'This action cannot be undone.', confirmText: 'Yes, Delete', cancelText: 'Cancel', onConfirm: () => { console.log('Item deleted'); }, onCancel: () => { console.log('Cancelled'); } });

Live Clock

Real-time clock display with customizable format.

Live Clock Demo
const clock = NASjs.liveClock('#clock', { format: '12', // '12' or '24' showSeconds: true, showDate: true }); // Control clock.stop(); clock.start();