JCard
A versatile container component that provides structured sections for headers, content, and footers. Perfect for dashboard widgets, content panels, and data displays.Basic Usage
Card Structure
A complete card can have three main sections:Header Features
Title and Subtitle
Header Toolbar
Header Divider Line
Scrollable Content
Collapsible Cards
Custom Styling
Complete Dashboard Example
Grid Layout Example
API Reference
Constructors
Creates an empty card
Creates a card with a title and body content
Creates a card with title and subtitle
Methods
Sets the card title
Sets the subtitle text (appears below title)
Adds a node to the toolbar area (right side of header)
Shows or hides a divider line below the header
Sets the main body content of the card
Sets the footer content (typically action buttons)
Wraps the body content in a ScrollPane to enable scrolling
Enables or disables collapse functionality. Adds a chevron icon to the header.
Sets the expanded/collapsed state (only works if collapsible is enabled)
Adds custom CSS style classes
CSS Style Classes
Cards generate the following CSS classes:card- Root card containercard-header- Header sectioncard-header-line- Header with divider linecard-title-box- Container for title and subtitlecard-title- Title labelcard-subtitle- Subtitle labelcard-toolbar- Toolbar container (right side of header)card-body- Body content areacard-footer- Footer sectioncard-scroll- Scrollable body wrappercard-chevron- Collapse/expand chevron icon
Best Practices
Use Cards for Grouped Content
Use Cards for Grouped Content
Cards work best when grouping related information or controls together. Use them for dashboard widgets, settings panels, or data displays.
Keep Headers Concise
Keep Headers Concise
Card titles should be brief and descriptive. Use subtitles for additional context if needed.
Limit Footer Actions
Limit Footer Actions
Use Scrollable for Long Content
Use Scrollable for Long Content
If your card body contains many items, use
makeScrollable() to keep the card at a reasonable height.Collapsible for Optional Content
Collapsible for Optional Content
Use collapsible cards for sections that users may want to hide, like advanced settings or detailed information.