Bjanczak\FilamentFlexFields\Filament\Schemas\Components\ItemCardExtends:
Filament\Schemas\Components\ComponentTraits:
CanOpenUrl, HasDescription, HasHeading, HasActions (Filament)
Use inside any Filament schema (Form, Section, ItemCardGroup, ItemCardStack, etc.).
Basic usage
Context: standalone vs group
Rendering mode is controlled by context. This changes surface styling (border, shadow, padding, chevron shape).
| Context | When | Visual behaviour |
|---|---|---|
auto (default) | Parent is ItemCardGroup → group; otherwise → standalone | Detected automatically |
group | Row inside a shared group surface | Flat row; no per-row border/shadow |
standalone | Outside ItemCardGroup (or forced) | Self-contained card: border, radius, shadow (variant-dependent), chevron in circle |
Variants
Set on the card (standalone) or inherited visually from the group row context.| Variant | Standalone appearance |
|---|---|
default | White surface, border, shadow |
secondary | Light gray surface, no shadow, transparent border |
tertiary | Darker gray surface, no shadow |
outline | Transparent background, visible border, no shadow |
transparent | Transparent background, no border, no shadow |
InvalidArgumentException.
Chainable configuration API
image(string|Closure|null $url)
Sets the leading media image URL for the item card.
imageShape(string|Closure $shape)
Sets the crop shape of the leading image (circle, square, or rounded). Default is circle.
imageAlt(string|Closure|null $alt)
Sets the alternative text for the leading media image.
Pressable click priority
When the row is pressable:url()→ navigation linkaction()/pressableAction()→wire:click→mountAction(...)withschemaComponentcontext- Chevron / group
pressable()only → visual feedback (ripple + hover), no server action unless you addpressableAction()
Public helper methods
| Method | Returns | Description |
|---|---|---|
getVariant() | string | Resolved variant name |
getIcon() | string|BackedEnum|Htmlable|null | Resolved icon |
hasChevron() | bool | Whether chevron is shown |
getContext() | string | group or standalone |
isPressable() | bool | Whether row renders as button/link |
getPressableAction() | Action|null | Prepared action for row click |
hasInteractiveAction() | bool | true when schema() has children |
getUrl() | string|null | Resolved URL |
shouldOpenUrlInNewTab() | bool | New tab flag |
Form integration
Fields inside->schema() are normal Filament form fields. They use the parent form statePath (e.g. data.dark_mode).
Validation runs on parent form submit ($this->form->validate()). Rules go on the field, not on ItemCard. Errors appear below each field in the trailing slot (standard Filament wrapper), not under ItemCardGroup.
Autosave / on change:
ItemCard / ItemCardGroup do not add their own state keys — only nested fields do.
Trailing actions (Filament Action)
Use Action / ActionGroup in schema() for visible buttons (not whole-row click):
->itemCard() is provided by the package Action class (CanStyleItemCardAction).
For press-and-hold destructive actions (no accidental click), use ->holdConfirm() instead of ->requiresConfirmation() — see Hold confirm action.
Select & switch in item cards
Select — useSelectField with variant('item-card'):
SwitchField with inline() and optional size('sm'):
Form panel layout (item-card--form-panel)
Default ItemCard is a horizontal row (icon | title | trailing control). For multi-field form sections, add the item-card--form-panel class via extraAttributes():
- Row 1: icon + title + description
- Row 2: child fields at full width
| Class | When to use |
|---|---|
item-card--form-panel | Vertical form section inside a card |
fff-form-layout--grid | Two-column card grid on ItemCardStack (from sm / 640px) |
Do not nest full-width fields in a plainItemCardwithoutitem-card--form-panel— controls render in the narrow trailing slot.
Inherited Filament schema component API
ItemCard extends Filament\Schemas\Components\Component. These methods work as in core Filament:
| Method | Description |
|---|---|
schema() / components() | Child components in the trailing slot |
key() | Explicit schema component key (optional; auto-set for action()) |
id() | HTML id attribute |
hidden() / visible() | Conditional rendering |
hiddenOn() / visibleOn() | Hide/show per operation |
extraAttributes() | Extra HTML attributes on root element |
columnSpan() / columnStart() | Grid layout when parent uses columns |
columns() / gap() | Child grid (default gap(0), columns(1) in setUp()) |
registerActions() | Register multiple named actions |
getAction() / getActions() | Resolve registered actions |
actionSchemaModel() | Model for action forms |
hasAction() | Whether a named action exists |
Closure with Filament utility injection.
HTML structure (data slots)
| Slot | Element |
|---|---|
data-slot="item-card" | Root (div, button, or a) |
item-card-icon | Leading icon container |
item-card-content | Title + description |
item-card-action | Trailing schema (fields, actions) |
item-card-chevron | Chevron indicator |
CSS classes
| Class | Meaning |
|---|---|
item-card | Base row |
item-card--{variant} | Surface variant |
item-card--context-standalone / --context-group | Layout context |
item-card--pressable | Interactive row |
item-card--form-panel | Vertical form layout (header row + full-width fields) |