Skip to content

Element initialization via components attributes Hash is not working #53

@msalzburg

Description

@msalzburg

The README describes that elements can also be initialized via the components attributes Hash.
Seems like this feature is not working properly (or missing?).

see README

Another good use case is a navigation component:

# app/components/navigation_component.rb %>

class NavigationComponent < ElementalComponents::Component
  element :items, multiple: true do
    attribute :label
    attribute :url
    attribute :active, default: false
  end
end
An alternative here is to pass a data structure to the component as an attribute, if no HTML needs to be injected when rendering the component:

<%= component "navigation", items: items %>

I already prepared a PR to make it work - or am I overseening sth. here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions