Create beautiful, flexible Application & Admin UIs in pure Ruby

Matestack UI Bootstrap ships styled UI components and smart CRUD tools for maximum productivity


How about putting together prebuilt styled components in pure Ruby rather than configuring something like ActiveAdmin? You can reuse existing security policies and unique business logic while rapidly implementing beautiful admin or application UIs!

Just like Matestack's core library matestack-ui-core, the addon library matestack-ui-bootstrap can be seamlessly integrated on top of existing controllers, models, routes and authentication/authorisation policies. Use solid UI abstraction while not compromising on the flexibility you need to drive your business!

Live Preview

Below you find a link to a dummy application built with matestack-ui-bootstrap.

All Bootstrap v5 components, available in pure Ruby


Alongside smart components, `matestack-ui` ships all Bootstrap v5 components enabling you to use them in pure Ruby.

Imagine adding a Bootstrap `card` component within one line of Ruby, skipping recreating the required DOM structures again and again? Mix that with Matestack's core components, Bootstrap's utility classes or custom CSS for customized UI implementation. That means you're able to use Bootstrap and Matestack UI Bootstrap components with a high level of abstraction for maximum productivity right next to core components like `div` with a lower level of abstraction for maximum flexibility!

On top of that, you're able to use all kinds of methods in order to render your UI based on conditions like `current_user.is_super_admin?`. Adjusting the UI to your custom rules based on pure Ruby is super easy. That's what we call `flexible abstraction`!

app/matestack/my_admin/pages/customer/index.rb


class MyAdmin::Pages::Customer::Index < Matestack::Ui::Page

  def response
    bs_container do
      bs_row do
        Customer.last(6).each do |customer|
          bs_col sm: 4, class: "mt-3" do
            card_for(customer)
          end
        end
      end
    end
  end

  def card_for customer
    bs_card title: customer.name, img_path: asset_pack_url('.../xyz.png'), class: "shadow-sm" do
      card_body_for(customer)
    end
  end

  def card_body_for customer
    small class: "mb-3" do
      b text: "Email:"
      plain customer.email
    end
    if current_user.is_super_admin?
      transition path: form_path(id: customer.id) do
        bs_btn size: :sm, text: "edit", class: "mt-3"
      end
    end
  end

end

Flexible, responsive, prebuilt app layouts


Use our prebuilt app templates through class inheritance in order to quickly setup typical layouts including sidebar and header navigation. Styles can be customized via SCSS theming.

Thanks to the fact that you're dealing with pure Ruby classes, it's also pretty easy to modify prebuilt UI structures and appearance in order to tailor the admin app to your individual needs.

app/matestack/my_admin/app.rb


class MyAdmin::App < Matestack::Ui::Bootstrap::Apps::AdminTemplate

  # the response method is defined by the parent class
  # you just need to pass in some configuration using the methods below
  # it's still possible to overwrite and adjust the response method
  # defined in the parent class

  def sidebar_top_partial
    div class: "text-center" do
      transition path: root_path, delay: 300 do
        h4 "Your Rails Backend"
      end
    end
    div class: "text-center my-5" do
      bs_avatar img_path: asset_pack_url('media/images/avatar-placeholder.png')
      div class: "my-3" do
        plain current_admin.email
      end
    end
  end

  def sidebar_navigation_items
    [
      { type: :transition, path: dummy_dashboard_path, text: "Dashboard", icon: "columns-gap" },
      { type: :transition, path: dummy_products_path, text: "Products", icon: "box" },
      { type: :transition, path: dummy_customers_path, text: "Customers", icon: "people-fill" },
      { type: :transition, path: dummy_orders_path, text: "Orders", icon: "cart-check-fill"},
    ]
  end

  def toasts
    [
      { show_on: "failure", class: "bg-danger text-white", body: "Error!" },
      { show_on: "success", class: "bg-primary text-white", body: "Success!" },
    ]
  end

end

Powerful page layout components for great UI experience


User components like `page_heading` or `section_card` together with grid components like `row` and `col` in order to quickly create a well structured, consistent and good looking UI.

Split rendering of complex, data-intesive UIs with Matestack's core `async` component and increase initial page load performance dramatically! All without writing one line of JavaScript.

app/matestack/my_admin/dashboard/show.rb


class MyAdmin::Pages::Dashboard::Show < Matestack::Ui::Page

  def response
    bs_page_heading title: t("dashboard.title"), subtitle: t("dashboard.subtitle")
    bs_row do
      bs_col md: 6 do
        analytics_partial
      end
      bs_col md: 6 do
        activity_partial
      end
    end
  end

  def analytics_partial
    async defer: 300, id: "products-card" do
      dashboard_products
    end
    async defer: 600, id: "revenue-card" do
      dashboard_revenue
    end
  end

  def activity_partial
    bs_row do
      bs_col do
        async defer: 900, rerender_on: "activity-tracked", id: "activity-card" do
          dashboard_activity
        end
      end
    end
  end

end

app/matestack/my_admin/components/dashboard/revenue.rb


# registered as `dashboard_revenue` via component registry

class MyAdmin::Components::Dashboard::Revenue < Matestack::Ui::Component

  def response
    section_card title: t("dashboard.revenue.title"), subtitle: t("dashboard.revenue.subtitle") do
      row do
        col xl: 6 do
          text_kpis_partial
        end
        col xl: 6, class: "py-3" do
          chart_kpis_partial
        end
      end
    end
  end

  # ...

end

Chart.js components accessible in pure Ruby


Want to visualize some data in charts? Matestack UI Bootstrap integrates chart.js and allows you to use chart components in pure Ruby without thinking of the JavaScript side!

Choose from `line`, `doughnut`, `bar` or `pie` charts and use theme colors for consistent coloring of datasets without touching CSS.

app/matestack/my_admin/components/dashboard/revenue.rb


class MyAdmin::Components::Dashboard::Products < Matestack::Ui::Component

  def response
    bs_section_card title: t("..."), subtitle: t("...") do
      bs_row do
        bs_col xl: 6 do
          text_kpis_partial
        end
        bs_col xl: 6, class: "py-3" do
          chart_kpis_partial
        end
      end
    end
  end

  protected

    # ...

    def chart_kpis_partial
      bs_chart type: :doughnut,
        datasets: [
          {
            data: top_5_product_values,
            backgroundColor: [:primary, :secondary, :blue, :indigo, :info]
          },
        ],
        labels: top_5_product_names
    end

    def top_5_products
      OrderItem
        .group(:product_id)
        .sum(:price_in_euro)
        .sort_by{|k, v| v}
        .reverse
        .first(5)
    end

    def top_5_product_values
      top_5_products
        .map { |product_id, value| value }
    end

    def top_5_product_names
      top_5_products
        .map { |product_id, value| Product.find(product_id).name }
    end

end

Reactive forms in no time


Matestack's core library already ships reactive forms, used with pure Ruby. Within matestack-ui-bootstrap you get styled form component, enabling you to create beautiful, reactive forms with a few lines of Ruby!

Create styled forms, with reactive error/success rendering without thinking of any implementation detail!

app/matestack/my_admin/components/users_form.rb


class MyAdmin::Components::UsersForm < Matestack::Ui::Component

  requires :user

  def response
    matestack_form form_config do
      bs_form_input   key: :name, type: :text, label: "Name"
      bs_form_input   key: :avatar, type: :file, label: "Avatar"
      bs_form_select  key: :role, options: [:client, :admin], label: "Role",
                        placeholder: "Select Role"
      bs_form_switch  key: :active, label: "Active?"
      bs_form_submit  button_variant: :primary, spinner_variant: :light, text: "Submit"
    end
  end

  def form_config
    {
      multipart: true, # due to file upload
      for: user,
      path: admin_user_path(user.id),
      method: :put,
      success: {
        emit: :success
      },
      failure: {
        emit: :failure
      }
    }
  end


end

Reactive, paginated, filterable tables, without the JavaScript hussle


Implementing a paginated, filterable collection is exhausting. And what about a reactivity when switching through the pages in order to avoid full page reloads? You don't want to build that yourself! That's why we've created the `collection` component, shipped within matestack-ui-core. The `smart_collection` shipped with `matestack-ui` gives you even more:

A few lines of Ruby is enough to add a styled, reactive paginated table with filters to your UI! You can optionally modify column rendering and per-row actions via method injection.

app/matestack/my_admin/pages/orders/index.rb


class MyAdmin::Pages::Orders::Index < Matestack::Ui::Page

  def response
    # ...
    bs_section_card do
      bs_smart_collection collection_config
    end
    # ...
  end

  def collection_config
    {
      id: 'orders',
      # Active Record query:
      items: Order.includes(:customer, :order_items).all,
      paginate: 10,
      rerender_on: "success",
      columns: {
        # just render the ID:
        id: 'ID',
        # render an attribute of a child model:
        'customer.last_name': {
          # use a specific table column heading:
          heading: 'Customer Name'
        },
        price_in_euro: {
          heading: 'Price in €',
          # transform the column content with a Proc:
          format: -> (column_data){ "#{column_data} €" },
          text: :right
        }
      },
      filters: {
        'customer.last_name': {
          placeholder: 'Filter by Customer Name',
          match: :starts_with,
        }
      },
      slots: {
        # inject a method which defines the per row actions:
        table_item_actions: method(:table_item_actions)
      }
    }
  end

  def table_item_actions order
    transition path: edit_dummy_order_path(order), delay: 300 do
      bs_btn outline: true, size: :sm, variant: :primary do
        bs_icon name: 'arrow-right', size: 20
      end
    end
  end


end

Customized collection rendering, if tables are not enough


You like, what the `smart_collection` does, but want to render something different than a table? No worries: you can inject your very own method, rendering the collection items.

In this example we're using our own `collection_rendering` method in order to render cards in a grid rather than displaying a table. All other features of a `smart_collections` are still working.

app/matestack/my_admin/pages/products/index.rb


class MyAdmin::Pages::Products::Index < Matestack::Ui::Page

  def response
    # ...
    bs_section_card do
      bs_smart_collection collection_config
    end
    # ...
  end

  def collection_config
    {
      id: 'products',
      items: Product.all,
      paginate: 9,
      rerender_on: "success",
      filters: {
        name: {
          placeholder: 'Filter by Name',
          match: :like
        },
      },
      slots: {
        collection_rendering: method(:collection_rendering)
      }
    }
  end

  def collection_rendering products
    slot do
      bs_row do
        products.each do |product|
          bs_col xl: 4, class: "mb-3" do
            collection_card product
          end
        end
      end
    end
  end

  def collection_card product
    bs_card title: product.name, subtitle: "#{product.price_in_euro} €", class: "h-100" do
      paragraph product.description, class: "fw-lighter"
      transition path: edit_dummy_product_path(product), delay: 300 do
        bs_btn outline: true, size: :sm, variant: :primary do
          bs_icon name: 'arrow-right', size: 20
        end
      end
      action product_delete_action_config(product) do
        bs_btn outline: true, size: :sm, variant: :danger do
          bs_icon name: 'trash2', size: 20
        end
      end
    end
  end

  def product_delete_action_config product
    {
      method: :delete,
      path: dummy_product_path(id: product.id),
      confirm: true,
      success: {
        emit: "success"
      }
    }
  end


end

Progressive integration


Just like matestack-ui-core, easily integrate matestack-ui-bootstrap into existing Rails projects. Integrate bootstrap components step by step.

Flexible abstraction


Unlike other admin UI gems, you can use solid abstraction while still being able to implement and reuse your business logic without being bound to a configuration-only approach!

Tailor to your usecase


Besides styling customizations, you are completely free to integrate the components into your individual workflows, security polcies and data structures.

Overview

Matestack UI Core

Matestack UI Core ships all you need to build reactive UIs in pure Ruby. You have to take care of styling and additional UI components yourself.

  • UI components in pure Ruby
  • Reactive components in pure Ruby
  • Reactive apps in pure Ruby
  • Growing documentation and Youtube Screencasts
  • Community support
Matestack UI Bootstrap

Matestack UI Bootstrap ships all you need to build beautiful, reactive UIs in pure Ruby and smart CRUD components. Don't think about styling anymore and just create admin or application UIs faster than ever before!

  • Everything included in Matestack UI Core, plus:
  • Admin and application UI templates in pure Ruby
  • Admin and application UI components in pure Ruby
  • Styled, reactive forms in pure Ruby
  • Styled, reactive date/timepicker in pure Ruby
  • Styled, reactive collections in pure Ruby
  • Styled, reactive charts in pure Ruby
  • All Bootstrap v5 components available in pure Ruby
  • Growing library of additional components (Kanban Board, Devise Components...)
Onboarding Service

You'd like to start using Matestack in your business, but need help to get things going and bring your team up to speed? I'm there for you!

  • Personal workshop for your team
  • Migrate existing apps to Matestack including team onboarding
  • Pair programming with your team
Custom Component Development

You need a component which is not available yet? Matestack can be extended without limitation. I create the missing component for you on a discounted price, if I'm allowed to provide the new component to all Matestack users.

  • Requirements engineering
  • Component development
  • Testing and documentation
  • Deploy