Skip to content

A new theme and UI kit for EasyAdminΒ #4011

@javiereguiluz

Description

@javiereguiluz

During the past months I've been working a lot on several backends made with EasyAdmin. Some were simple whereas others were highly customizable:

  • The good news is that I haven't found many rough edges or blockers. Yes, there are lots of things to fix and improve, but I didn't face awful or very bad features/behaviors.
  • The bad news is that creating custom actions/pages took lot of time and it wasn't easy to reuse design elements between them. I ended up with lots of repeated HTML and CSS contents.

I was thinking about ways to improve things ... and I think our biggest problem is our current template. In previous versions we used AdminLTE ... which we abandoned for EA3 because it looked dated and abandoned. Then we created a custom template based on Stripe, the most beautiful backend that I know of. The next step would be to create an "UI kit" based on that, to have a series of design components to design custom things. However:

  • I won't ever have time for this.
  • I don't think I'm skilled enough to design this.
  • Even if we do this, it will still be a custom-made UI kit, which we'll have to fix/maintain/improve forever.

So, instead of doing that, I started looking for "UI kits" that are open source and beautiful templates. There aren't many, but I found one that I liked a lot: Tabler

A few months ago it looked "abandoned", but it's regaining a lot of development activity and it's fully based on Bootstrap (they are aiming at the still unreleased Bootstrap 5). So, I think it's the perfect candidate to solve our problem.

I've started the migration of EasyAdmin to Tabler. It's far from finished, but it's progressing nicely. In addition to visual/design changes, I'm also making UX/UI improvements too. For example, in #4010 we were asked about adding a better paginator. Well, this is how the new paginator looks in my EasyAdmin+Tabler proof of concept:

image

Apart from this, having a "UI kit" like Tabler will allow us to create lots of design components so you can design your own backend actions/pages. My idea is to create Twig functions like this:

ea_theme_*(...arguments)

For example:

ea_theme_page_title(string $content, array $attr = [])
ea_theme_paginator(EntityPaginator $paginator, array $attr = [])
ea_theme_table(array $headers, array $rows, array $attr = [])
ea_theme_metric(string $value, string $label, string $subLabel = '', string $help = '', string $icon = '', array $attr = [])

And you can use those in your template like this:

{# attr is a list of HTML attributes applied to the parent HTML element of the component #}
{{ ea_theme_page_title('List of users of XXX', ['class' => 'text-large']) }}

Some of these functions will have lots and lots of arguments because the components are complex and very configurable. But, I don't think this is a problem thanks to Twig named params:

ea_theme_metric(value = num_users, label = 'New users', icon = 'fas fa-user')

The HTML of all these components would be defined as blocks in a single Twig template and the Twig function would render the appropriate block only. Like a Symfony form them but custom made.

So, what do you think of this proposal?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions