Sha256: ab089da2feb2cdd7918911f7bb7eefe8ccd7799d9b3710be683e7612e0b7f449
Contents?: true
Size: 767 Bytes
Versions: 6
Compression:
Stored size: 767 Bytes
Contents
module Components::TabsHelper def render_tabs(&block) @_tabs = [] capture(&block) render "components/ui/tabs" end def tab_list(&block) content_for :tab_list, capture(&block), flush: true end def tab(title, **options) options[:id] ||= "tab_#{title.parameterize}" options[:state] = options[:active] ? "active" : "inactive" @_tabs << {title: title, id: options[:id]} render("components/ui/tabs/tab", title:, options:) end def tab_panels(&block) content_for :tab_panels, capture(&block), flush: true end def tab_panel(**options, &block) options[:state] = options[:active] ? "active" : "inactive" content_for :panel, capture(&block), flush: true render("components/ui/tabs/panel", options:) end end
Version data entries
6 entries across 6 versions & 1 rubygems