Skip to content

Add titles to cards#46

Merged
koppen merged 9 commits intomainfrom
card_titles
Nov 13, 2025
Merged

Add titles to cards#46
koppen merged 9 commits intomainfrom
card_titles

Conversation

@koppen
Copy link
Copy Markdown
Member

@koppen koppen commented Nov 12, 2025

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds title functionality to the Flowbite::Card component, allowing cards to display an optional title either through an argument or a slot.

Key Changes:

  • Added renders_one :title slot support to Card component with both argument-based and slot-based title rendering
  • Created new Flowbite::Card::Title component for rendering card titles with default Flowbite styling
  • Updated card template to render titles conditionally

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
app/components/flowbite/card.rb Added title slot declaration, title parameter to initializer, and helper methods (default_title, default_title_content, default_title_options, title?) to support title rendering
app/components/flowbite/card/title.rb New component that renders an h5 title element with Flowbite's default card title styling
app/components/flowbite/card/card.html.erb New template that renders the card container with optional title and content sections
test/components/flowbite/card_test.rb Added three tests covering title argument usage, title options passing, and title slot functionality
demo/test/components/previews/card_preview.rb Added preview examples for cards with title argument and title slot, along with grouping annotations
CHANGELOG.md Documented the new title feature in the Unreleased section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@koppen koppen force-pushed the card_titles branch 2 times, most recently from b4790c4 to 784643d Compare November 13, 2025 07:41
koppen and others added 9 commits November 13, 2025 08:46
By passing in the title as an argument you'll get the default rendering
(which is a h5 tag with appropriate classes) without needing to manually
render a Card::Title component in every card.
We want to be able to pass both content and options to the title element
so we should follow the samme pattern as other components like
InputField.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@koppen koppen merged commit 195ae67 into main Nov 13, 2025
5 checks passed
@koppen koppen deleted the card_titles branch November 13, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants