class Voom::Presenters::DSL::Components::ExpansionPanel

Attributes

open[RW]

Public Class Methods

new(**attribs_, &block) click to toggle source
# File lib/voom/presenters/dsl/components/expansion_panel.rb, line 10
def initialize(**attribs_, &block)
  super(type: :expansion_panel, **attribs_, &block)
  self.text(attribs.delete(:text)) if attribs.key?(:text)
  self.secondary_text(attribs.delete(:secondary_text)) if attribs.key?(:secondary_text)
  @open = attribs.delete(:open) { false }
  expand!
end

Public Instance Methods

content(**attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/expansion_panel.rb, line 28
def content(**attribs, &block)
  return @content if locked?
  @content = Content.new(parent: self, **attribs, &block)
end
secondary_text(*text, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/expansion_panel.rb, line 23
def secondary_text(*text, **attribs, &block)
  return @secondary_text if locked?
  @secondary_text = Components::Typography.new(parent: self, type: :text, text: text,  **attribs, &block)
end
text(*text, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/expansion_panel.rb, line 18
def text(*text, **attribs, &block)
  return @text if locked?
  @text = Components::Typography.new(parent: self, type: :text, text: text, **attribs, &block)
end