app/components/shadcn/form_builder.rb in shadcn-ui-0.0.12 vs app/components/shadcn/form_builder.rb in shadcn-ui-0.0.13
- old
+ new
@@ -35,10 +35,21 @@
id: "#{object_name}_#{method}",
value: @object.send(method),
type: "email", **options
)
end
-
+
+ def text_area(method, options = {})
+ error_class = @object.errors[method].any? ? "error" : ""
+ options[:class] = @template.tw("#{options[:class]} #{error_class}")
+ @template.render_textarea(
+ name: "#{object_name}[#{method}]",
+ id: "#{object_name}_#{method}",
+ value: @object.send(method),
+ type: "text", **options
+ )
+ end
+
def submit(value = nil, options = {})
@template.render_button(value, **options)
end
private