Sha256: afdfc3a239e665709dfa515de3dbec6a793ef49b3d629440601812afd4af3e8e
Contents?: true
Size: 1.33 KB
Versions: 12
Compression:
Stored size: 1.33 KB
Contents
module Coprl module Presenters module DSL module Components class TabBar < Base attr_reader :tabs def initialize(**attribs_, &block) super(type: :tab_bar, **attribs_, &block) @tabs = [] expand! end def tab(label, **attribs, &block) @tabs << Tab.new(parent: self, label: label, **attribs, &block) end class Tab < EventBase include Mixins::Common attr_accessor :components, :label, :icon, :stacked, :selected def initialize(**attribs_, &block) super(type: :tab, **attribs_, &block) @label = attribs.delete(:label){nil} @icon = attribs.delete(:icon) {nil} @stacked = attribs.delete(:stacked) {false} @selected = attribs.delete(:selected) {false} @components = [] expand! end def label(text = nil) return @label if locked? @label = text end def icon(icon = nil, **attribs, &block) return @icon if locked? @icon = Components::Icon.new(parent: self, icon: icon, **attribs, &block) end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems