Class: Shadcn::AlertComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::AlertComponent
- Defined in:
- app/components/shadcn/alert_component.rb
Overview
Alert component for displaying important messages Matches shadcn/ui Alert component
Constant Summary collapse
- VARIANTS =
Available alert variants
{ default: "bg-background text-foreground", destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive" }.freeze
- BASE_CLASSES =
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
-
#initialize(variant: :default, **options) ⇒ AlertComponent
constructor
A new instance of AlertComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(variant: :default, **options) ⇒ AlertComponent
Returns a new instance of AlertComponent.
46 47 48 49 |
# File 'app/components/shadcn/alert_component.rb', line 46 def initialize(variant: :default, **) super(**) @variant = variant.to_sym end |