CodeIgniter Forums
Components for Codeigniter 4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Components for Codeigniter 4 (/showthread.php?tid=92283)



Components for Codeigniter 4 - dgvirtual - 01-06-2025

I would like to announce a semi-new Components library for CI4. It allows to encapsulate html and css classes/styles into reusable website building blocks.
See it here: https://packagist.org/packages/dgvirtual/codeigniter4-components
It allows to write this in your view:
PHP Code:
<x-green-button onclick="alert('I was clicked!')">
  <?= $clickMeLabel ?>
</x-green-button> 
and after rendering get this sent to your browser:
PHP Code:
<button
    style
="color: white; background-color: green;"
    <?= isset($onclick) ? 'onclick="' $onclick '"' '' ?>
>
    <?= $slot ?>
</button> 
This functionality has been available in Bonfire2 for a while, but I have extracted it and put it into an installable composer package.

Bonfire2 was written mainly by Lonnie Ezell (@kilishan), so most of the credit goes to him.

Hope you will find it as useful as I have.


RE: Components for Codeigniter 4 - InsiteFX - 01-07-2025

@dgvirtual, Thanks this should be helpful.