Class: Shadcn::ItemComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::ItemComponent
- Defined in:
- app/components/shadcn/item_component.rb
Overview
Item component - a flexible flex container for titles, descriptions, and actions Matches shadcn/ui Item component
Constant Summary collapse
- VARIANTS =
{ default: "bg-transparent", outline: "border border-border rounded-lg", muted: "bg-muted/50 rounded-lg" }.freeze
- SIZES =
{ default: "p-4 gap-4", sm: "p-3 gap-3" }.freeze
- BASE_CLASSES =
"flex items-start"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variant: :default, size: :default, tag: :div, href: nil, **options) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(variant: :default, size: :default, tag: :div, href: nil, **options) ⇒ ItemComponent
Returns a new instance of ItemComponent.
72 73 74 75 76 77 78 |
# File 'app/components/shadcn/item_component.rb', line 72 def initialize(variant: :default, size: :default, tag: :div, href: nil, **) super(**) @variant = variant.to_sym @size = size.to_sym @tag = href ? :a : tag @href = href end |
Instance Method Details
#call ⇒ Object
80 81 82 |
# File 'app/components/shadcn/item_component.rb', line 80 def call content_tag(@tag, item_content, **item_attributes) end |