Class: ShadcnPhlexcomponents::Alert
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- ShadcnPhlexcomponents::Alert
show all
- Defined in:
- lib/shadcn_phlexcomponents/components/alert.rb
Constant Summary
Constants inherited
from Base
Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER
Instance Method Summary
collapse
Methods inherited from Base
#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child
Constructor Details
#initialize(variant: :default, **attributes) ⇒ Alert
Returns a new instance of Alert.
27
28
29
30
|
# File 'lib/shadcn_phlexcomponents/components/alert.rb', line 27
def initialize(variant: :default, **attributes)
@class_variants = { variant: variant }
super(**attributes)
end
|
Instance Method Details
#default_attributes ⇒ Object
40
41
42
|
# File 'lib/shadcn_phlexcomponents/components/alert.rb', line 40
def default_attributes
{ role: "alert" }
end
|
#description(**attributes) ⇒ Object
36
37
38
|
# File 'lib/shadcn_phlexcomponents/components/alert.rb', line 36
def description(**attributes, &)
AlertDescription(**attributes, &)
end
|
#title(**attributes) ⇒ Object
32
33
34
|
# File 'lib/shadcn_phlexcomponents/components/alert.rb', line 32
def title(**attributes, &)
AlertTitle(**attributes, &)
end
|
#view_template ⇒ Object
44
45
46
|
# File 'lib/shadcn_phlexcomponents/components/alert.rb', line 44
def view_template(&)
div(**@attributes, &)
end
|