module Lucky::MountComponent

Direct including types

Defined in:

lucky/mount_component.cr

Instance Method Summary

Instance Method Detail

def m(component : Lucky::BaseComponent.class, *args, **named_args) : Nil #

Appends the component to the view.

When Lucky::HTMLPage.settings.render_component_comments is set to true, it will render HTML comments showing where the component starts and ends.

m(MyComponent)
m(MyComponent, with_args: 123)

[View source]
def m(component : Lucky::BaseComponent.class, *args, **named_args, &) : Nil #

Appends the component to the view. Takes a block, and yields the args passed to the component.

When Lucky::HTMLPage.settings.render_component_comments is set to true, it will render HTML comments showing where the component starts and ends.

m(MyComponent, name: "Jane") do |name|
  text name.upcase
end

[View source]
def mount(component : Lucky::BaseComponent) : Nil #

Appends the component to the view.

When Lucky::HTMLPage.settings.render_component_comments is set to true, it will render HTML comments showing where the component starts and ends.

mount MyComponent.new

DEPRECATED Use #m instead. Example: m(MyComponent, arg1: 123)


[View source]
def mount(component : Lucky::BaseComponent, &) : Nil #

Appends the component to the view. Takes a block, and yields the args passed to the component.

When Lucky::HTMLPage.settings.render_component_comments is set to true, it will render HTML comments showing where the component starts and ends.

mount MyComponent.new("jane") do |name|
  text name.upcase
end

DEPRECATED Use #m instead. Example: m(MyComponent, arg1: 123) do/end


[View source]