setTheme
setTheme(string $theme)
The `setTheme` function in Grocery CRUD enables you to customize the visual theme of your CRUD interface.
Please note that a theme involves the entire HTML, JS, and CSS structure, not just color changes.
The syntax for using this function is straightforward:
$crud->setTheme('myTheme')
You have the option to select from three available themes:
- bootstrap-v4
- bootstrap-v5 (default)
- grocery-crud (new theme)
The bootstrap-v4 and bootstrap-v5 themes are built on top of Bootstrap, so they expect Bootstrap
to be available on your page.
The grocery-crud theme does not depend on a CSS framework. It brings its own styling, which makes it
a good fit when your application doesn't use Bootstrap, or already has a design system of its own.
$crud->setTheme('grocery-crud');
All three themes support both the light and the dark skin, which you can set with setSkin.
Example
$crud->setTheme('bootstrap-v4');
$crud->setTable('customers');
$crud->setSubject('Customer', 'Customers');
$crud->columns(['customerName','phone','addressLine1','creditLimit']);