
Summary
SaaS-style media card for hero banners, product tiles, and CTA blocks. Supports background image, gradient, or solid color, optional top/footer copy, and a footer action button.| Class | Bjanczak\FilamentFlexFields\Filament\Schemas\Components\CoverCard |
| State | None — display/action component (footer action may use Livewire) |
| Extends | Filament\Schemas\Components\Component |
Basic usage
Portrait product card
Full-width low banner
Use a wide aspect ratio withfullWidth() — height follows width, not a fixed pixel height.
Gradient strip (no image)
Configuration API
Background
| Method | Description |
|---|---|
backgroundImage(string|Closure|null $url) | Cover image URL. Sanitized via SafeMediaUrl (javascript: etc. rejected). Takes precedence over gradient for background-image. |
backgroundGradient(string|Closure|null $gradient) | CSS gradient string when no image is set. |
backgroundColor(string|Closure|null $color) | Fallback / underlay color. |
backgroundPosition(string|Closure $position) | CSS background-position. Default: center. |
Layout & sizing
| Method | Description |
|---|---|
ratio(string|Closure|null $ratio) | Aspect ratio via inline aspect-ratio. Formats: 3:4, 16:9, 21:9, 3:1, auto (no fixed ratio). Default: 3:4. |
fullWidth(bool|Closure $condition = true) | Removes default max-width: 20rem cap (.is-full-width). |
contentMaxWidth(string|Closure|null $width) | Custom max-width when not full width (e.g. '18rem'). Ignored when fullWidth() is true. |
Copy blocks
| Method | Description |
|---|---|
topTitle() / topDescription() | Header block at top of card (optional). |
footerTitle() / footerDescription() | Footer copy block (optional). |
footerAction(Action|Closure|null $action) | Filament Action rendered as pill CTA in footer. Closure shorthand creates a default labeled action. |
Appearance
| Method | Values | Default |
|---|---|---|
tone(string|Closure $tone) | dark, light | dark |
radius(string|Closure $radius) | md, lg, xl, 2xl | xl |
Content overlays
| Method | Description |
|---|---|
contentOverlays(bool|Closure $condition = true) | Enables separate top/bottom gradient overlay elements instead of the global scrim. Top overlay renders only when top copy exists; bottom overlay only when footer copy/action exists. |
topOverlayGradient(string|Closure|null $gradient) | Custom CSS gradient for the top ::before overlay. |
footerOverlayGradient(string|Closure|null $gradient) | Custom CSS gradient for the bottom ::after overlay. |
Public helper methods
| Method | Returns |
|---|---|
getAspectRatioStyle() | CSS ratio string e.g. 3 / 4, or null when ratio('auto') |
getBackgroundStyles() | Inline style fragments for background layer |
getFooterAction() | Registered footer Action or null |
hasTopContent() / hasFooterContent() | Whether copy blocks are filled |
hasContentOverlays() / shouldShowTopOverlay() / shouldShowFooterOverlay() | Content overlay state |
isFullWidth() | Whether full-width mode is active |
CSS classes
| Class | Meaning |
|---|---|
fff-cover-card | Root card |
fff-cover-card--tone-{dark|light} | Text/scrim variant |
fff-cover-card--radius-{md|lg|xl|2xl} | Corner radius |
is-full-width | No max-width constraint |
fff-cover-card__background | Background layer |
fff-cover-card__scrim | Global gradient overlay (when contentOverlays() is off) |
fff-cover-card__overlay--top / --bottom | Separate gradient overlay elements |
fff-cover-card__content | Copy + action container |
Implementation notes
- Invalid
ratioor unsupportedtone/radiusthrowsInvalidArgumentException. - Image URLs are escaped in inline styles; unsafe schemes return
nullfromgetBackgroundImage(). - Playground examples live under Cover card in Flex Fields Playground.