Class: ShadcnPhlexcomponents::FormError
- Defined in:
- lib/shadcn_phlexcomponents/components/form/form_error.rb
Constant Summary
Constants inherited from Base
Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER
Instance Method Summary collapse
-
#initialize(message, aria_id: nil, **attributes) ⇒ FormError
constructor
A new instance of FormError.
- #view_template ⇒ Object
Methods inherited from Base
#before_template, #convert_collection_hash_to_struct, #default_attributes, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child
Constructor Details
#initialize(message, aria_id: nil, **attributes) ⇒ FormError
Returns a new instance of FormError.
14 15 16 17 18 |
# File 'lib/shadcn_phlexcomponents/components/form/form_error.rb', line 14 def initialize(, aria_id: nil, **attributes) @message = @id = aria_id ? "#{aria_id}-message" : nil super(**attributes) end |
Instance Method Details
#view_template ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/shadcn_phlexcomponents/components/form/form_error.rb', line 20 def view_template(&) if @message p(id: @id, **@attributes) { @message } else p(id: @id, **@attributes, &) end end |