Class: NfgUi::Components::Elements::Badge

Overview

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.

Constant Summary

Constants included from Traits::Pill

Traits::Pill::TRAITS

Constants included from Traits::Theme

Traits::Theme::COLOR_TRAITS, Traits::Theme::TRAITS

Constants included from Traits

Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES

Instance Attribute Summary

Attributes included from Bootstrap::Utilities::Disableable

#as

Attributes included from Bootstrap::Utilities::Wrappable

#as

Attributes inherited from Bootstrap::Components::Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Traits::Pill

#pill_trait

Methods included from Traits::Theme

#danger_trait, #dark_trait, #info_trait, #light_trait, #outlined_trait, #primary_trait, #secondary_trait, #success_trait, #warning_trait, #white_trait

Methods included from Utilities::Renderable

#render_if, #render_unless

Methods included from Utilities::Describable

#data, #describe

Methods included from Utilities::Traitable

#traits, #utility_initialize

Methods included from Utilities::Iconable

#icon

Methods included from Bootstrap::Utilities::Tooltipable

#data, #disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip

Methods included from Bootstrap::Utilities::Disableable

#disabled

Methods inherited from Bootstrap::Components::Badge

#pill

Methods included from Bootstrap::Utilities::Wrappable

#utility_initialize

Methods included from Bootstrap::Utilities::Themeable

#outlined, #theme

Methods inherited from Bootstrap::Components::Base

#component_family, #data, #href, #html_options, #id, #initialize, #style

Constructor Details

This class inherits a constructor from NfgUi::Bootstrap::Components::Base

Instance Method Details

#renderObject



20
21
22
23
24
25
26
27
28
# File 'lib/nfg_ui/components/elements/badge.rb', line 20

def render
  super do
    if icon
      NfgUi::Components::Foundations::Icon.new({ traits: [icon], text: body }, view_context).render
    else
      (block_given? ? yield : body)
    end
  end
end