class NfgUi::Components::Patterns::SlatActions

Slat doc coming soon

Public Instance Methods

component_family() click to toggle source
# File lib/nfg_ui/components/patterns/slat_actions.rb, line 20
def component_family
  :slats
end
menu() click to toggle source

Signals whether or not this SlatActions will house a menu This is a critical condition. When false, a SlatAction is automatically integrated on your behalf.

render() { |: body)| ... } click to toggle source
# File lib/nfg_ui/components/patterns/slat_actions.rb, line 31
def render
  content_tag(:div, html_options) do
    if menu
      NfgUi::Components::Patterns::Dropdown.new({ }, view_context).render do
        capture do
          concat(NfgUi::Components::Elements::DropdownToggle.new({ **default_dropdown_toggle_options, body: dropdown_toggle_body }, view_context).render)
          concat(NfgUi::Components::Patterns::DropdownMenu.new({ traits: [:right] }, view_context).render {
            (block_given? ? yield : body)
          })
        end
      end
    else
      # Render the integrated slat action and pass in all of the
      # related slat action options that are present in this SlatActions `:options`
      render_integrated_slat_action
    end
  end
end

Private Instance Methods

default_dropdown_toggle_options() click to toggle source
# File lib/nfg_ui/components/patterns/slat_actions.rb, line 52
def default_dropdown_toggle_options
  { outlined: true, theme: :secondary }
end
dropdown_toggle_body() click to toggle source
non_html_attribute_options() click to toggle source
# File lib/nfg_ui/components/patterns/slat_actions.rb, line 60
def non_html_attribute_options
  super.push(:menu)
end