class NfgUi::Components::Elements::Table

Table doc coming soon

Public Instance Methods

caption() click to toggle source
# File lib/nfg_ui/components/elements/table.rb, line 16
def caption
  options.fetch(:caption, default_caption)
end
render() click to toggle source
# File lib/nfg_ui/components/elements/table.rb, line 20
def render
  # We manually embed this caption as a typeface component
  # as part of the design pattern.
  if caption.present?
    capture do
      concat(NfgUi::Components::Foundations::Typeface.new({caption: caption.to_s, class: 'mb-1 text-right', traits: [:muted]}, view_context).render)

      concat(super)
    end
  else
    super
  end
end

Private Instance Methods

default_caption() click to toggle source

By default, when responsive: supply a pre-written caption to the table

# File lib/nfg_ui/components/elements/table.rb, line 37
def default_caption
  responsive ? I18n.t('nfg_ui.components.elements.table.responsive_caption') : ''
end
non_html_attribute_options() click to toggle source
# File lib/nfg_ui/components/elements/table.rb, line 41
def non_html_attribute_options
  super.push(:caption)
end