Attrs

Reactive HTML attributes and inline styles bound to state.

Reactive attribute demo

Count:
PHP
<?php $cnt = state(0); $app = el('div', [ cls('container') ], [ el('h2', [], [ text('Reactive attribute demo') ]), el('button', [ attrs(['title' => concat('Clicked ', read($cnt), ' times')]), cls('btn btn-primary'), style(['padding'=>'8px 12px','margin'=>'6px','border'=>'1px solid #ccc']), on('click', inc($cnt, 1)) ], [ text('Hover me, then click') ] ), el('div', [], [ text(concat('Count: ', read($cnt))) ]), ]);