Accordion

When you want to say a lot but not all at once
Includes a Ruby component and corresponding Rails helper
Ruby
Includes a Stimulus controller
Stimulus

Example

<%= nk_accordion do |a| %>
  <%= a.item do %>
    <%= a.trigger "Item 1" %>
    <%= a.content do %>
      <p>Content</p>
    <% end %>
  <% end %>
  <%= a.item do %>
    <%= a.trigger "Item 2" %>
    <%= a.content do %>
      <p>Content</p>
    <% end %>
  <% end %>
<% end %>

Usage

nk_accordion(**attrs) { |accordion| ... }
PropertyDefaultDescription
**attrsHTML attributes for <div> element
accordion.item(**attrs) { ... }
PropertyDefaultDescription
**attrsHTML attributes for <div> element
accordion.trigger(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <button> element
accordion.content(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <div> element