FileDropzone
class FileDropzone extends BeartropyComponent
FileDropzone component.
A drag-and-drop file upload area with client-side validation, image previews, existing-file support, and Livewire integration.
Traits
Trait HasPresets.
Trait HasErrorBag.
Properties
| string|null | $size | Component size (md, lg, etc.) used for preset resolution. |
from BeartropyComponent |
| string|null | $id | Component ID. |
|
| string|null | $name | Input name. |
|
| string|null | $label | Label text. |
|
| string|null | $color | Color preset. |
|
| bool | $multiple | Allow multiple files. |
|
| string|null | $accept | File accept attribute (e.g. "image/*,.pdf"). |
|
| int|null | $maxFileSize | Max file size in bytes (null = no limit). |
|
| int|null | $maxFiles | Max number of files (null = unlimited). |
|
| string|null | $placeholder | Override empty-state text. |
|
| bool | $preview | Show image previews. |
|
| bool | $clearable | Allow clearing selection. |
|
| bool | $disabled | Disabled state. |
|
| mixed | $customError | Custom error message. |
|
| string|null | $help | Help text. |
|
| string|null | $hint | Hint text (alias for help). |
|
| array | $existingFiles | Existing files [{name, url, size?, type?}]. Color Presets |
|
| bool | $primary | Primary color (alias for beartropy). |
|
| bool | $beartropy | Beartropy color. |
|
| bool | $red | Red color. |
|
| bool | $orange | Orange color. |
|
| bool | $amber | Amber color. |
|
| bool | $yellow | Yellow color. |
|
| bool | $lime | Lime color. |
|
| bool | $green | Green color. |
|
| bool | $emerald | Emerald color. |
|
| bool | $teal | Teal color. |
|
| bool | $cyan | Cyan color. |
|
| bool | $sky | Sky color. |
|
| bool | $blue | Blue color. |
|
| bool | $indigo | Indigo color. |
|
| bool | $violet | Violet color. |
|
| bool | $purple | Purple color. |
|
| bool | $fuchsia | Fuchsia color. |
|
| bool | $pink | Pink color. |
|
| bool | $rose | Rose color. |
|
| bool | $slate | Slate color. |
|
| bool | $gray | Gray color. |
|
| bool | $zinc | Zinc color. |
|
| bool | $neutral | Neutral color. |
|
| bool | $stone | Stone color. |
Methods
Compute component presets based on context.
No description
No description
No description
No description
No description
No description
No description
No description
No description
Determine the error state for a specific field.
Analyze wire:model attributes to determine binding state.
Resolve the size preset for the component.
Create a new FileDropzone component instance.
Format bytes to a human-readable string.
Build the accept/size hint string shown below the dropzone icon.
Get the view / contents that represent the component.
Details
in
HasPresets at line 21
array
getComponentPresets(string|null $componentName = null, ComponentAttributeBag|null $attributes = null)
Compute component presets based on context.
in
HasPresets at line 59
protected array
loadPresets(string $componentName)
No description
in
HasPresets at line 73
protected array
loadComponentDefaults(string $componentName)
No description
in
HasPresets at line 88
protected bool
detectHasVariants(array $colors)
No description
in
HasPresets at line 116
protected array
computeSupports(array $sizes, array $colorsArray, array $defaults, array $magicProps)
No description
in
HasPresets at line 137
protected array
resolveSize(array $supports, array $sizes, array $defaults, array $magicProps)
No description
in
HasPresets at line 174
protected array
resolveVariant(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, bool $hasVariants)
No description
in
HasPresets at line 223
protected array
resolveColor(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, string|null $variant, bool $hasVariants)
No description
in
HasPresets at line 293
protected array
resolveFill(array $supports, array $attributes, array $defaults)
No description
in
HasPresets at line 338
protected string
buildCacheKey(string $component, array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill)
No description
in
HasPresets at line 349
protected void
syncInstanceProps(array $supports, string|null $size, string|null $variant, string|null $color)
No description
in
HasPresets at line 365
protected array
buildPresetNames(array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill, string $sizeOrigin, string $variantOrigin, string $colorOrigin, string $fillOrigin)
No description
in
HasPresets at line 384
protected void
debugWarnings(array $supports, array $sizePreset, array $colorPreset, string $componentName, string|null $variant, string|null $color)
No description
in
HasErrorBag at line 24
array
getErrorState(ComponentAttributeBag|null $attributes = null, ViewErrorBag|MessageBag|null $errors = null, string|null $error = null)
Determine the error state for a specific field.
Checks both the session error bag and specific error attributes.
Looks up errors by wire:model value or name attribute.
in
BeartropyComponent at line 33
array
getWireModelState(ComponentAttributeBag|null $attributes = null)
Analyze wire:model attributes to determine binding state.
Detects if wire:model is present and if it uses dot notation (e.g., user.name).
in
BeartropyComponent at line 64
array
getSizePreset(string|null $componentName = null, array|ComponentAttributeBag|null $attributes = null, string $defaultSize = 'md')
Resolve the size preset for the component.
Checks:
- Explicit
$this->size. - Magic attributes (e.g.,
<x-button sm />). - Default size.
at line 76
__construct(string|null $id = null, string|null $name = null, string|null $label = null, string|null $color = null, bool $multiple = true, string|null $accept = null, int|null $maxFileSize = null, int|null $maxFiles = null, string|null $placeholder = null, bool $preview = true, bool $clearable = true, bool $disabled = false, mixed $customError = null, string|null $help = null, string|null $hint = null, array $existingFiles = [])
Create a new FileDropzone component instance.
at line 101
string
formatBytes(int $bytes)
Format bytes to a human-readable string.
at line 119
string
getAcceptHint()
Build the accept/size hint string shown below the dropzone icon.
at line 137
View
render()
Get the view / contents that represent the component.