aw codes icon logo
Docs Hub

Search across every project.

Curator Switch project

A media picker plugin for FilamentPHP.

5.x Current

On this page

Picker field

CuratorPicker opens Curator's modal so an author can pick existing media or upload something new. Many of Filament's FileUpload methods work on it too, for per-field sizing and validation.

use Awcodes\Curator\Components\Forms\CuratorPicker;
use Filament\Support\Enums\Size;

CuratorPicker::make('featured_image_id')
    ->label('Featured image')
    ->buttonLabel('Choose an image')
    ->size(Size::Medium)
    ->constrained();

Appearance

Method Effect
buttonLabel() Text on the trigger button.
color() Trigger colour. Defaults to gray.
outlined() Outlined trigger. Defaults to true.
size() Trigger size, taking a Size enum case.
constrained() Fits the image inside the preview area. Defaults to false.
listDisplay() Shows selections as a list. Defaults to true.
lazyLoad() Lazy-loads previews. Defaults to true.
defaultPanelSort() Sort direction for the picker panel. Defaults to desc.

Selection and storage

Method Effect
multiple() Allow more than one item. Required when using a relationship with multiple media.
maxItems() Cap how many items can be selected.
relationship() Bind to a relationship — see Relationships.
orderColumn() Rename the order column used by multiple relationships. Defaults to order.
pathGenerator() Where uploads are written — see Path generation.
limitToDirectory() Restrict the picker to its own directory. Requires the directory_restriction feature.
tenantAware() Scope to the current tenant. Defaults to true.

Uploads also accept the familiar Filament methods — preserveFilenames(), maxWidth(), minSize(), maxSize(), rules(), acceptedFileTypes(), disk(), visibility(), directory(), imageCropAspectRatio(), imageResizeMode(), imageResizeTargetWidth() and imageResizeTargetHeight(). See Filament's file upload documentation for what each does.

Note

acceptedFileTypes() defaults to Curator's own safe list rather than allowing everything — see Accepted file types.