class Voom::Presenters::DSL::Components::Chip

Attributes

chipset_variant[R]
color[R]
icons[R]
name[R]
selected[R]
value[R]

Public Class Methods

new(**attribs_, &block) click to toggle source
Calls superclass method
# File lib/voom/presenters/dsl/components/chip.rb, line 9
def initialize(**attribs_, &block)
  super(type: :chip,
        **attribs_, &block)
  @icons = []
  self.text(attribs.delete(:text)) if attribs.key?(:text)
  self.icon(attribs.delete(:icon)) if attribs.key?(:icon)
  @color = attribs.delete(:color)
  @name = attribs.delete(:name)
  @value = attribs.delete(:value)
  @selected = attribs.delete(:selected){false}
  expand!
  @chipset_variant = self.parent(:chipset)&.variant.to_s
end

Public Instance Methods

icon(icon=nil, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/chip.rb, line 28
def icon(icon=nil, **attribs, &block)
  @icons << Icon.new(parent: self, icon: icon,
                     **attribs, &block)
end
menu(**attributes, &block) click to toggle source
text(*text, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/chip.rb, line 23
def text(*text, **attribs, &block)
  return @text if locked?
  @text = Components::Typography.new(parent: self, type: :text, text: text, **attribs, &block)
end