File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
resources/views/components Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 2929 ' size-8' => ! $label ,
3030 ' py-1 ps-3 pe-4 gap-1' => $label ,
3131 ] )
32- aria-label =" {{ __ (' filament-quick-create::quick-create.button_label' ) } }"
32+ @if ($tooltip )
33+ x-tooltip =" {
34+ content: '{{ $tooltip } } '
35+ }"
36+ @endif
37+ aria-label =" {{ __ (' quick-create::quick-create.button_label' ) } }"
3338 >
3439 <x-filament::icon
3540 alias =" filament-quick-create::add"
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ class QuickCreateMenu extends Component implements HasActions, HasForms
3939
4040 public ?array $ keyBindings = null ;
4141
42+ public ?string $ tooltip = null ;
43+
4244 /**
4345 * @throws Exception
4446 */
@@ -49,6 +51,7 @@ public function mount(): void
4951 $ this ->hiddenIcons = QuickCreatePlugin::get ()->shouldHideIcons ();
5052 $ this ->label = QuickCreatePlugin::get ()->getLabel ();
5153 $ this ->keyBindings = QuickCreatePlugin::get ()->getKeyBindings ();
54+ $ this ->tooltip = QuickCreatePlugin::get ()->getTooltip ();
5255 }
5356
5457 /**
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ class QuickCreatePlugin implements Plugin
5454
5555 protected array |Closure |null $ modalExtraAttributes = null ;
5656
57+ protected string |Closure |null $ tooltip = null ;
58+
5759 public static function get (): static
5860 {
5961 return filament (app (static ::class)->getId ());
@@ -355,4 +357,16 @@ public function getModalExtraAttributes(): ?array
355357 {
356358 return $ this ->evaluate ($ this ->modalExtraAttributes );
357359 }
360+
361+ public function tooltip (string |Closure |null $ tooltip = null ): static
362+ {
363+ $ this ->tooltip = $ tooltip ?? __ ('quick-create::quick-create.button_label ' );
364+
365+ return $ this ;
366+ }
367+
368+ public function getTooltip (): ?string
369+ {
370+ return $ this ->evaluate ($ this ->tooltip );
371+ }
358372}
You can’t perform that action at this time.
0 commit comments