Class: Primrose::Components::TextField

Inherits:
Rose
  • Object
show all
Defined in:
lib/primrose/components/text_field.rb

Instance Attribute Summary

Attributes inherited from Rose

#children, #event_handlers, #state

Instance Method Summary collapse

Methods inherited from Rose

#add_child, #after_mount, #after_render, #after_unmount, #before_mount, #before_render, #before_unmount, #get_binding, #handle_error, #lifecycle, #on, #render_children, #setup, #trigger

Constructor Details

#initialize(placeholder:, name: nil, label: nil, min_length: nil, max_length: nil, read_only: false, default_value: nil, style_class: nil) ⇒ TextField

Returns a new instance of TextField.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/primrose/components/text_field.rb', line 6

def initialize(placeholder:, name: nil, label: nil, min_length: nil, max_length: nil, read_only: false, default_value: nil, style_class: nil)
  @placeholder = placeholder
  @name = name
  @label = label
  @min_length = min_length
  @max_length = max_length
  @read_only = read_only
  @default_value = default_value
  @style_class = style_class
  super()
end

Instance Method Details

#renderObject



18
19
20
# File 'lib/primrose/components/text_field.rb', line 18

def render
  Prim.render('templates/components/text_field.prim.erb', self)
end