Dialog

Modal schmodal
Includes a Ruby component and corresponding Rails helper
Ruby
Includes a Stimulus controller
Stimulus

Example

New post

Start off your new post with a tantilizing promise that your article can't live up to.
<%= nk_dialog do |d| %>
  <%= d.trigger "New post" %>
  <%= d.dialog do %>
    <%= d.title "New post" %>
    <%= d.description "Start off your new post ..." %>

    <%= nk_form_for ... do %>
      ...
    <% end %>

    <%= d.close_button %>
  <% end %>
<% end %>

Usage

nk_dialog(**attrs) { |dialog| ... }
PropertyDefaultDescription
**attrsHTML attributes for <div> element
dialog.trigger(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsArguments for NitroKit::Button.new()
dialog.dialog(**attrs) { ... }
PropertyDefaultDescription
**attrsHTML attributes for <dialog> element
dialog.close_button(**attrs) { ... }
PropertyDefaultDescription
**attrsArguments for NitroKit::Button.new()
dialog.title(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <h2> element
dialog.description(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <div> element