Select
class Select extends InputTriggerBase
Select Component.
A powerful select input supporting arrays, Eloquent collections, remote search, and object mapping.
Traits
Trait HasPresets.
Trait HasErrorBag.
Properties
| $size | |||
| $color | |||
| $label | |||
| $placeholder | |||
| $type | from InputTriggerBase | ||
| $hasError | from InputTriggerBase | ||
| $name | from InputTriggerBase | ||
| $disabled | from InputTriggerBase | ||
| $options | |||
| $selected | |||
| $icon | |||
| $searchable | |||
| $multiple | |||
| $clearable | |||
| $remote | |||
| $remoteUrl | |||
| $initialValue | |||
| $perPage | |||
| $customError | |||
| $hint | |||
| string|null | $optionLabel | Field map for option label. |
|
| string|null | $optionValue | Field map for option value. |
|
| string|null | $optionDescription | Field map for option description. |
|
| string|null | $optionIcon | Field map for option icon. |
|
| string|null | $optionAvatar | Field map for option avatar. |
|
| $autosave | |||
| $autosaveMethod | |||
| $autosaveKey | |||
| $autosaveDebounce | |||
| $emptyMessage | |||
| $isEmpty | |||
| $spinner |
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
Retrieve the error state for a given attribute or context.
Create a new Select component instance.
Analyze wire:model attributes to determine binding state.
Get the size preset configuration.
Resolve the size preset for the component.
Resolve the color preset configuration.
Normalize options into a standard array format.
Details
in
HasPresets at line 22
array{0: array, 1: array, 2: bool, 3: array}
getComponentPresets(string|null $componentName = null, ComponentAttributeBag|null $attributes = null)
compute component presets based on context.
in
HasPresets at line 64
protected array
loadPresets(string $componentName)
No description
in
HasPresets at line 75
protected array
loadComponentDefaults(string $componentName)
No description
in
HasPresets at line 88
protected bool
detectHasVariants(array $colors)
No description
in
HasPresets at line 100
protected array
computeSupports(array $sizes, array $colorsArray, array $defaults, array $magicProps)
No description
in
HasPresets at line 118
protected array
resolveSize(array $supports, array $sizes, array $defaults, array $magicProps)
No description
in
HasPresets at line 149
protected array
resolveVariant(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, bool $hasVariants)
No description
in
HasPresets at line 193
protected array
resolveColor(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, string|null $variant, bool $hasVariants)
No description
in
HasPresets at line 258
protected array
resolveFill(array $supports, array $attributes, array $defaults)
No description
in
HasPresets at line 303
protected string
buildCacheKey(string $component, array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill)
No description
in
HasPresets at line 313
protected void
syncInstanceProps(array $supports, string|null $size, string|null $variant, string|null $color)
No description
in
HasPresets at line 326
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 344
protected void
debugWarnings(array $supports, array $sizePreset, array $colorPreset, string $componentName, string|null $variant, string|null $color)
No description
in
HasErrorBag at line 21
array{__bt_wireModel: string|null, __bt_finalError: string|null, __bt_hasError: bool}
getErrorState(string|null $error = null, ComponentAttributeBag|null $attributes = null, MessageBag|null $errors = null)
Retrieve the error state for a given attribute or context.
at line 111
__construct($options = null, $selected = null, $icon = null, string|null $placeholder = 'Seleccionar...', $searchable = true, string|null $label = null, $multiple = false, $clearable = true, $remote = false, $remoteUrl = null, string|null $size = null, string|null $color = null, $initialValue = null, $perPage = 15, $customError = null, $hint = null, $autosave = false, $autosaveMethod = 'savePreference', $autosaveKey = null, $autosaveDebounce = 300, $optionLabel = 'label', $optionValue = 'value', $optionDescription = 'description', $optionIcon = 'icon', $optionAvatar = 'avatar', $emptyMessage = 'No se encontraron opciones', $spinner = true)
Create a new Select component instance.
in
BeartropyComponent at line 65
array{0: bool, 1: string|null, 2: bool, 3: string|null}
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 92
array<string,mixed>
getComponentSizePreset(string|null $componentName = null, ComponentAttributeBag|null $attributes = null)
Get the size preset configuration.
Legacy method for size resolution. Prioritizes size property, then magic attributes.
in
BeartropyComponent at line 133
array<string,mixed>
getSizePreset(string|null $componentName = null, ComponentAttributeBag|array|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.
in
BeartropyComponent at line 167
array<string,mixed>
getColorPreset(string $component, string|null $color = null, string|null $variant = null)
Resolve the color preset configuration.
Handles color resolution based on component config, variants, and defaults.
at line 337
View|Closure|string
render()
Get the view / contents that represent the component.
at line 201
protected array<string,array{_value: mixed, label: string|null, icon: string|null, avatar: string|null, description: string|null}>
normalizeOptions(mixed $options)
Normalize options into a standard array format.
Handles:
- Eloquent Collections.
- Associative arrays (key => label).
- Indexed arrays.
- Array of Options (objects/arrays).
Uses configured field mappings (optionLabel, optionValue) to extract data.