File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,16 @@ def styles
2121 end
2222
2323 def call
24- content_tag ( :div , class : self . class . classes ) do
24+ content_tag ( :div , { class : self . class . classes } . merge ( @options ) ) do
2525 concat ( content_tag ( :div , content , class : "font-normal text-gray-700 dark:text-gray-400" ) )
2626 end
2727 end
28+
29+ # @param options [Hash] Additional HTML options for the card container
30+ # (e.g., custom classes, data attributes). These options are merged into
31+ # the card's root element.
32+ def initialize ( **options )
33+ @options = options || { }
34+ end
2835 end
2936end
Original file line number Diff line number Diff line change @@ -8,4 +8,10 @@ def test_renders_a_default_card
88
99 assert_selector ( "div.p-6.bg-white.border.border-gray-200.rounded-lg.shadow-sm" )
1010 end
11+
12+ def test_passes_extra_options_to_the_card_as_attributes
13+ render_inline ( Flowbite ::Card . new ( id : "card-1" ) ) { "Card Content" }
14+
15+ assert_selector ( "div#card-1" )
16+ end
1117end
You can’t perform that action at this time.
0 commit comments