Skip to content

Commit d7779dc

Browse files
author
Nils Henning
committed
update migration guide
1 parent 3304555 commit d7779dc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,39 @@ def my_simple_slot
363363
end
364364
```
365365

366+
### Components in Rails Legacy Views
367+
368+
It is now possible to use core and custom components in your Rails legacy views. Matestack provides a `matestack_component` helper to use components in views and partials.
369+
370+
Create a component
371+
```ruby
372+
class HeaderComponent < Matestack::Ui::StaticComponent
373+
requires :title
374+
375+
def response
376+
header id: 'my-page-header' do
377+
plain title
378+
end
379+
end
380+
381+
end
382+
```
383+
384+
Register it in your registry
385+
```ruby
386+
module Components::Registry
387+
Matestack::Ui::Core::Component::Registry.register_components(
388+
header_component: HeaderComponent,
389+
)
390+
end
391+
```
392+
393+
And use it in your view as follows:
394+
```html
395+
<%= matestack_component(:header_component, title: 'A Title') %>
396+
```
397+
398+
366399
### Removed Components
367400

368401
#### Inline Component

0 commit comments

Comments
 (0)