Class: Panda::Core::Admin::DropdownComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/panda/core/admin/dropdown_component.rb

Overview

Reusable dropdown menu component with a chevron trigger.

Uses the pre-registered dropdown Stimulus controller from tailwindcss-stimulus-components for toggle, outside-click close, Escape key close, and CSS transitions.

Examples:

Basic dropdown

<%= render Panda::Core::Admin::DropdownComponent.new do |dropdown| %>
  <% dropdown.with_item(label: "Edit", href: edit_path) %>
  <% dropdown.with_item(label: "Delete", href: delete_path, method: :delete) %>
<% end %>

With custom trigger content

<%= render Panda::Core::Admin::DropdownComponent.new do |dropdown| %>
  <% dropdown.with_trigger_slot do %>
    Last 30 days
    
  <% end %>
  <% dropdown.with_item(label: "Last 7 days", href: "?period=7d") %>
<% end %>

Defined Under Namespace

Classes: ItemComponent

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Method Summary

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Panda::Core::Base