class NfgUi::Components::Elements::DropdownToggle

Badge doesn't have any customizations unique to the design system yet As such, the NFG UI badge is simply a bootstrap badge behind the scenes. Traits will eventually be connected here.

Public Instance Methods

icon() click to toggle source
# File lib/nfg_ui/components/elements/dropdown_toggle.rb, line 20
def icon
  options.fetch(:icon, 'caret-down')
end
render() { |: body)| ... } click to toggle source
# File lib/nfg_ui/components/elements/dropdown_toggle.rb, line 24
def render
  NfgUi::Components::Elements::Button.new({ as: as, theme: theme, **html_options, remove_component_css_classes: nav_link, icon: icon }, view_context).render do
    capture do
      if left_icon
        concat(NfgUi::Components::Foundations::Icon.new({ traits: [left_icon], class: NfgUi::Components::Foundations::Icon::LEFT_ICON_SPACER_CSS_CLASS }, view_context).render)
      end
      concat(block_given? ? yield : body)
    end
  end
end