Modern HTML - REACTIVE Laravel Library for Faster Web Development
A comprehensive solution for dynamic interactions, SPA routing, Excel-like form computation, and much more. Enhance user experience easily without excessive JavaScript complexity.
All-in-one library providing a modern web development experience with Laravel
Automatic AJAX system with simple HTML attributes. No need to write manual JavaScript.
Automatic real-time calculations with Excel-like formulas. Supports SUM, AVG, SUMIF and date functions.
Single Page Application with automatic routing. Smooth navigation without page reload.
Show/hide elements dynamically based on input conditions. Reactive UI without complex JavaScript.
Automatically refresh content periodically. Ideal for real-time dashboards and notifications.
Automatic data synchronization between elements. Easy-to-use two-way data binding.
Start using LiveDomJS in minutes
If using Laravel, LiveDomJs can be installed directly through Packagist:
# Install package
composer require gadingrengga/livedomjs
# Run installation to publish assets and routes
php artisan livedomjs:install
Add the following script to your Blade layout after jQuery:
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="{{ asset('vendor/livedomjs/livedom.js') }}"></script>
Note: Make sure jQuery is loaded before LiveDomJS to avoid errors.
Add CSRF token in the head section of your template:
<meta name="csrf-token" content="{{ csrf_token() }}">
Comprehensive guide for all LiveDomJS features
Automatic AJAX system with simple HTML attributes for server interaction without page reload.
live-scope - Defines controller
live-click - Method called on
clicklive-target - Target element for
responselive-method - HTTP method
(GET/POST)live-loading - Show loading
indicatorlive-submit - Submit form via
AJAXlive-change - Trigger when value
changeslive-keyup - Trigger on keyup
live-input - Trigger on input
live-hover - Trigger on hover
<div live-scope="user">
<input name="name" type="text" placeholder="User Name">
<button live-click="save" live-target="#result" live-loading="true" live-loading-indicator>
Save User
</button>
<div id="result"></div>
</div>
Real-time calculation system with Excel-like formulas. Supports various mathematical and date functions.
sum(field)avg(field)min(field)max(field)count(field)sumif(range, criteria, sum_range)rangeDate(start, end)rangeMonth(start, end)rangeYear(start, end)rangeWeek(start, end)idr - Rupiah Formatcurrency - Dollar Formatdecimal - 2 Decimalspercent - Percentagedays/months/years<!-- Automatic calculation -->
<input name="qty" type="number" value="10">
<input name="price" type="number" value="5000">
<input live-compute="qty * price" live-compute-format="idr" readonly>
<!-- With manual control -->
<input name="subtotal" live-compute="sum(rows_?_qty * rows_?_price)"
live-compute-format="idr" live-compute-skip="true">
Control element visibility and styling based on input conditions in real-time.
live-show
Show/hide element based on condition
live-class
Add/remove CSS classes dynamically
live-style
Change inline styles dynamically
live-attr
Change element attributes dynamically
<!-- Show based on value -->
<div live-show="status == 'active'">
Content for active status
</div>
<!-- Class based on condition -->
<div live-class="price > 1000 ? 'text-red-500' : 'text-green-500'">
Price changes color
</div>
Single Page Application with automatic routing and smooth navigation without page reload.
window.liveDomConfig = {
spaExcludePrefixes: [
'/api/',
'/download/',
'/admin/export'
]
};
<!-- Layout with SPA regions -->
<div live-spa-region="header">
<nav>...</nav>
</div>
<div live-spa-region="main">
<!-- Main content to be updated -->
</div>
<div live-spa-region="sidebar">
<!-- Sidebar that can be updated -->
</div>
Automatic data synchronization between elements with easy-to-use two-way data binding.
<!-- Input source -->
<input name="username" type="text">
<!-- Elements that will sync -->
<span live-bind="username"></span>
<input live-bind="username" readonly>
Automatically refresh content periodically. Ideal for real-time dashboards, notifications, and monitoring.
<!-- Polling every 5 seconds -->
<div id="notifications"
live-poll="5000"
live-scope="dashboard"
live-click="getNotifications">
<!-- Content will be updated automatically -->
</div>
See LiveDomJS in action in various real-world scenarios
Create, Read, Update, Delete with AJAX without reload
<div live-scope="UserController">
<form live-submit="store" live-target="#user-list">
<input type="text" name="name" placeholder="Name" required>
<input type="email" name="email" placeholder="Email" required>
<button type="submit" >
Save
</button>
</form>
<div id="user-list">
@include('users.list')
</div>
</div>
class UserController extends Controller
{
public function store(Request $request)
{
$user = User::create($request->all());
return view('users.list')->render();
}
}
Real-time calculation with automatic formatting
<div live-scope="invoice">
<input name="qty" type="number" value="1">
<input name="price" type="number" value="100000">
<!-- Automatic subtotal -->
<input name="subtotal"
live-compute="qty * price"
live-compute-format="idr" readonly>
<!-- 10% tax -->
<input name="tax"
live-compute="subtotal * 0.1"
live-compute-format="idr" readonly>
<!-- Total -->
<input name="total"
live-compute="subtotal + tax"
live-compute-format="idr" readonly>
</div>
Show/hide elements based on user input
<div live-scope="form">
<select name="user_type">
<option value="personal">Personal</option>
<option value="company">Company</option>
</select>
<!-- Appears if company -->
<div live-show="user_type == 'company'">
<input name="company_name" placeholder="Company Name">
<input name="tax_id" placeholder="Tax ID">
</div>
<!-- Dynamic class based on condition -->
<div live-class="user_type == 'company' ? 'bg-blue-100' : 'bg-gray-100'">
Additional info
</div>
</div>
Fields for Company:
Additional info (background changes automatically)
Advanced capabilities for complex applications
Execute functions before and after AJAX requests for more detailed control.
<button live-click="save"
live-callback-before="beforeSave"
live-callback-after="afterSave">
Save Data
</button>
function beforeSave(element) {
// Validation or confirmation
return confirm('Are you sure you want to save?');
}
Target elements with flexible jQuery selectors for precise DOM manipulation.
<!-- Target multiple with selector -->
<button live-click="update"
live-target="closest(.card), next(.info)">
Update
</button>
<!-- Various DOM actions -->
<button live-click="add"
live-dom="append,show"
live-target="#list,#notification">
Add Item
</button>
Send specific arguments to controller methods for more dynamic logic.
<!-- Single argument -->
<button live-click="updateStatus('active')">
Activate
</button>
<!-- Multiple arguments -->
<button live-click="setPrice(100000, 'idr')">
Set Price
</button>
<!-- Dynamic with element value -->
<button live-click="calculate(this.dataset.id, qty)">
Calculate
</button>
public function updateStatus($status)
{
// $status contains 'active'
$model->status = $status;
$model->save();
}
public function setPrice($amount, $currency)
{
// Handle price with currency
return response()->json([
'success' => true,
'data' => "Price set to {$amount} {$currency}"
]);
}
Guide for using LiveDomJS optimally
live-scope for good
organizationlive-loading for good UXlive-compute-skip for manual
inputs