Dropdown
Everybody get down this is a contextual menu.
Includes a Ruby component and corresponding Rails helper
RubyIncludes a Stimulus controller
StimulusExample
<%= nk_dropdown do |d| %>
<%= d.trigger "Open" %>
<%= d.content do %>
<%= d.title "My hotdogs" %>
<%= d.separator %>
<%= d.item "New hotdog", new_hotdog_path %>
<%= d.item "Edit hotdog", edit_hotdog_path(1) %>
<%= d.separator %>
<%= d.destructive_item "Delete hotdog",
hotdog_path(1),
data: { turbo_method: "delete", turbo_confirm: "Sure?" } %>
<% end %>
<% end %>
Dependencies
This component adds third-party dependencies:
Usage
| ||
---|---|---|
Property | Default | Description |
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
text | nil | Plain text content |
**attrs | Arguments for NitroKit::Button.new() |
| ||
---|---|---|
Property | Default | Description |
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
text | nil | Plain text content |
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
text | nil | Plain text content |
href | nil |
If passed, the item will be an <a> link.
|
variant | :default | One of :default / :destructive |
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
text | nil | Plain text content |
href | nil |
If passed, the item will be an <a> link.
|
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
**attrs | HTML attributes for <hr> element |