diff --git a/resources/views/components/create-menu.blade.php b/resources/views/components/create-menu.blade.php index 02b585f..14b07cf 100644 --- a/resources/views/components/create-menu.blade.php +++ b/resources/views/components/create-menu.blade.php @@ -29,7 +29,12 @@ 'size-8' => ! $label, 'py-1 ps-3 pe-4 gap-1' => $label, ]) - aria-label="{{ __('filament-quick-create::quick-create.button_label') }}" + @if($tooltip) + x-tooltip="{ + content: '{{ $tooltip }}' + }" + @endif + aria-label="{{ __('quick-create::quick-create.button_label') }}" > hiddenIcons = QuickCreatePlugin::get()->shouldHideIcons(); $this->label = QuickCreatePlugin::get()->getLabel(); $this->keyBindings = QuickCreatePlugin::get()->getKeyBindings(); + $this->tooltip = QuickCreatePlugin::get()->getTooltip(); } /** diff --git a/src/QuickCreatePlugin.php b/src/QuickCreatePlugin.php index 5fe1e9b..538d4f4 100644 --- a/src/QuickCreatePlugin.php +++ b/src/QuickCreatePlugin.php @@ -54,6 +54,8 @@ class QuickCreatePlugin implements Plugin protected array|Closure|null $modalExtraAttributes = null; + protected string|Closure|null $tooltip = null; + public static function get(): static { return filament(app(static::class)->getId()); @@ -355,4 +357,16 @@ public function getModalExtraAttributes(): ?array { return $this->evaluate($this->modalExtraAttributes); } + + public function tooltip(string|Closure|null $tooltip = null): static + { + $this->tooltip = $tooltip ?? __('quick-create::quick-create.button_label'); + + return $this; + } + + public function getTooltip(): ?string + { + return $this->evaluate($this->tooltip); + } }