App API

An app defines a layout within its response method and uses the yield_page method to yield the content of a page in its layout.

Use core components

app/matestack/example_app/app.rb

class ExampleApp::App < Matestack::Ui::App

  def response
    heading size: 1, text: "My Example App Layout"
  end

end

Use registered custom components

Imagine having created and registered a custom component card. Go ahead and use it on your page:

app/matestack/example_app/pages/example_page.rb

class ExampleApp::Pages < Matestack::Ui::Page

  def response
    heading size: 1, text: "My Example App Layout"
    # calling your registered card component without using matestack_component helper!
    card title: "hello"
  end

end

Yielding Matestack pages

app/matestack/example_app/app.rb

Transitions between pages without page reload

app/matestack/example_app/app.rb

The transition components will trigger async HTTP requests and exchange the page content without a page reload.

Transitions between pages with loading element

app/matestack/example_app/app.rb

which will render:

and during async page request triggered via transition:

You can use the loading class and your loading state element to implement CSS based loading state effects. It may look like this (scss):

For more informations on transitions, visit transitions

Last updated

Was this helpful?