Loki_AdminComponents

This Magento 2 module allows for developers to build admin grids and admin forms in the Magento 2 Admin Panel in a faster way. No more ugly UiComponents that nobody understands. Create grids and forms quickly. And gradually add features to them, without getting stuck.

The LokiAdminComponents are based on the Loki Components module which is also used in the LokiCheckout. However, this admin tool shows that the Loki suite of Yireo can be applied in many more places.

Note that this library makes use of Alpine.js in the Magento Admin Panel. However, TailwindCSS is not used, we stick to the native Magento Admin Panel classes instead.

Installation

composer require loki/magento2-admin-components
bin/magento module:enable Loki_AdminComponents Loki_Components

Examples

As a demo, you could opt to install the following examples:

Screenshot of YireoTraining_ExampleLokiAdminProducts

Features

Grid features

  • Autodetection of columns
  • Search
  • Pagination
  • Sorting columns
  • Custom cell templates
  • Inline editing
  • Filters
  • Mass Actions
  • Custom cell templates
  • ... (more docs coming soon)

Grid provider handlers

  • repository
  • collection
  • array

Form features

  • Autodetection of columns
  • Field-types (select, text, number, datetime, etc) with option to configure more
  • Form actions (Back, Save and Close, Save and Continue, Delete, etc)
  • ... (more docs coming soon)

Documentation

See the wiki

Todo

  • Easily extend LokiComponent partials via XML layout
  • Add file view/adminhtml/loki/example-grid.xml
  • Example database query in custom array provider
  • Extension Attributes
  • Filesystem navigation
  • Tiles instead of grid layout
  • Delete add confirmation
  • Add custom SearchCriteriaBuilder via repository addons
  • Switch field for enabled/disabled column within grid
  • Export selected to CSV, JSON, XSLX

Support

For getting support, create an Issue under the following project URL:

https://github.com/LokiExtensions/Loki_AdminComponents

Module Dependencies

The following dependencies are declared in the module its `etc/module.xml` file:

Loki_Components Magento_Backend Magento_Catalog Magento_Customer Magento_Eav Magento_Ui
Composer details
Magento module name
Loki_AdminComponents
Composer name
loki/magento2-admin-components
Composer version
0.2.6
Default branch
master
Requirements
magento/framework: ^102.0 | ^103.0
magento/module-backend: ^101.0 | ^102.0
magento/module-catalog: ^102.0 | ^103.0 | ^104.0
magento/module-customer: ^102.0 | ^103.0
magento/module-eav: ^100.0 | ^101.0 | ^102.0
magento/module-ui: ^101.0
loki/magento2-components: ^2.0
ext-json: *
Releases
dev-master 28 August 2025
0.2.6 28 August 2025
0.2.5 26 August 2025
0.2.4 21 August 2025
0.2.3 18 August 2025
0.2.2 06 August 2025
0.2.1 24 July 2025
0.2.0 21 July 2025
0.1.1 11 July 2025
0.1.0 10 July 2025
Changelog

[0.2.6] - 28 August 2025

Fixed

  • Do not escape pricing format
  • Fix wrong initialization of grid filter options
  • Re-enable saving array values
  • Add product_id field type
  • Remove requirement of repository provider to define additional factory
  • Get rid of confusing parent-block behaviour
  • Implement delete and duplicate for collection provider
  • Implement saving an item via collection provider
  • Automatically set primary key to field_type "view"
  • Allow changing HTML attributes of textarea; Rename html_attributes to field_attributes
  • Transform field_type string to FieldTypeInterface instance
  • Allow hiding a complete field with label by setting "visible=false"
  • Simplify structure of Field and FieldFactory class
  • Retrieve modelClass and resourceModelClass from provider
  • Add CI files

[0.2.5] - 26 August 2025

Fixed

  • Remove CSS util again
  • Additional work on grids and form arguments

[0.2.4] - 21 August 2025

Fixed

  • Do not add CSS util for Alpine-based :class
  • Fix CSS utils
  • Declare used PHP namespaces
  • Document latest version of template
  • Add missing strict_types declaration

[0.2.3] - 18 August 2025

Fixed

  • Lower requirements to PHP 8.1
  • Add escaping in PHTML templates

[0.2.2] - 06 August 2025

Fixed

  • Lower PHP requirement to PHP 8.2+

[0.2.1] - 24 July 2025

Fixed

  • Change workflow condition
  • Add GitHub Actions

[0.2.0] - 21 July 2025

Fixed

  • Rename PHP namespace from Yireo_Loki* to Loki*
  • Rename composer package from yireo/magento2-loki* to loki/magento2*

[0.1.1] - 11 July 2025

Fixed

  • Allow for item convertors in forms
  • Configure HTML attributes per field
  • Enhance exceptions when you are being stupid
  • Remove allowActions from provider

[0.1.0] - 10 July 2025

Refactor

  • Rename from Yireo_LokiAdminComponents to Loki_AdminComponents
  • Rename from yireo/magento2-loki-admin-components to loki/magento2-admin-components

[0.0.10] - 18 June 2025

Fixed

  • Merge fields detected with info from XML layout
  • Add Datetime field-type
  • Fix issue when filters are not saved to grid yet
  • Allow custom cell templates via block-name
  • Allow for static grid filters
  • Add component groups loki_admin.grid and loki_admin.form
  • Read row_actions from XML layout
  • Additional field types (date, number, view)
  • Refactor field detection
  • Add createItem to provider handlers
  • Add LESS file
  • Fix saveAndClose action again by redirecting to index page
  • Exception when no factory class is set in form
  • Properly set indexUrl after form AJAX-reload
  • Add current URI to component params
  • Throw friendly error if block is not component yet
  • Add buttons for filters
  • Add recursive options for select options
  • Fix z-index with limit box
  • Move JS code into partials
  • Visual mock for filters
  • Fix redirect after mass action
  • Working demo of mass actions with products
  • Mass actions

[0.0.9] - 17 May 2025

Fixed

  • First bits on filters
  • Allow sorting of repositories, collections and arrays
  • Support for buttons + subbuttons
  • Support for buttons with redirect
  • Allow setting edit_url via XML layout

[0.0.8] - 16 May 2025

Fixed

  • Configure allow_actions via XML layout
  • Allow configuring URLs via XML layout
  • Hide any actions from array grid

[0.0.7] - 16 May 2025

Fixed

  • Disallow actions with arrays
  • Fix new ProviderHandlerListing for forms as well

[0.0.6] - 16 May 2025

Fixed

  • Do not try to print an object
  • Add instruction to enable Yireo_LokiComponents
  • WIP on autodetecting searchable fields
  • Remove tut and move to wiki

[0.0.5] - 16 May 2025

Fixed

  • Make state methods get and save public
  • Make sure each grid uses namespaced session values
  • Refactor provider handler resolving

[0.0.4] - 16 May 2025

Fixed

  • Add support for grid and collection providers
  • Hide search when there are no searchable fields
  • Add samples
  • Automatically create fields from entity
  • Refactor form actions into reusable buttons
  • Detect provider handler type automatically
  • Throw error if no identifier when loading item

[0.0.3] - 13 May 2025

Fixed

  • Move non-public methods to bottom
  • Fetch searchable fields from resource model if available
  • Update MODULE.json
  • Fix PHPStan issue because wrong type hint in core
  • Update license

[0.0.2] - 07 May 2025

Added

  • Basic implementation of array and collection handler
  • Allow adding provider via XML layout as object
  • Determine columns by default from first item being loaded
  • Finish inline edit
  • Save reposition to bookmark
  • Make grid namespace configurable
  • Allow for repositioning columns properly
  • Refactor grid actions into DI-configurable actions
  • Rename actions folder to action-buttons
  • Simplify loading of grid bookmark

[0.0.1] - 06 May 2025

Added

  • Initial release

Last modified: July 22, 2025