module Lucky::MountComponent

Direct including types

Defined in:

lucky/mount_component.cr

Instance Method Summary

Instance Method Detail

def mount(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.

mount(MyComponent)
mount(MyComponent, with_args: 123)

[View source]
def mount(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.

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

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

Appends the component to the view. The component is a previously initialized instance of a component.

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

component = MyComponent.new(name: "Jane")
mount_instance(component)

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

Appends the component to the view. Takes a block, and yields the args passed to the component. The component is a previously initialized instance of a component.

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

component = MyComponent.new(name: "Jane")
mount_instance(component) do |name|
  text name.upcase
end

[View source]