From 71e8360a2818ba8bbc8943a4c2b9f3026d0b6453 Mon Sep 17 00:00:00 2001 From: Lara van Diemen Date: Mon, 20 Apr 2026 10:32:19 +0200 Subject: [PATCH] feat: add tooltip component --- README.md | 71 +++++++++++-------- .../views/components/tooltip/index.blade.php | 12 ++++ .../components/tooltip/trigger.blade.php | 11 +++ src/Components/Tooltip.php | 17 +++++ src/ComponentsServiceProvider.php | 16 ++++- 5 files changed, 97 insertions(+), 30 deletions(-) create mode 100644 resources/views/components/tooltip/index.blade.php create mode 100644 resources/views/components/tooltip/trigger.blade.php create mode 100644 src/Components/Tooltip.php diff --git a/README.md b/README.md index f3162eb..9da054a 100644 --- a/README.md +++ b/README.md @@ -132,35 +132,35 @@ Example usage with Navi: @php($menu = \Log1x\Navi\Navi::make()->build('primary_navigation')) @if ($menu->isNotEmpty()) - - - @foreach ($menu->all() as $item) - - - {!! $item->label !!} - @if ($item->children) - - @endif - - - @if ($item->children) - - @foreach ($item->children as $child) - - - {!! $child->label !!} - - - @endforeach - - @endif - - @endforeach - - + + + @foreach ($menu->all() as $item) + + + {!! $item->label !!} + @if ($item->children) + + @endif + + + @if ($item->children) + + @foreach ($item->children as $child) + + + {!! $child->label !!} + + + @endforeach + + @endif + + @endforeach + + @endif ``` @@ -203,6 +203,19 @@ Usage without Navi: ``` +### Tooltip + +Usage: + +```blade + + Hover or focus me + + + This is the tooltip content. + +``` + ## About us [![banner](https://raw.githubusercontent.com/yardinternet/.github/refs/heads/main/profile/assets/small-banner-github.svg)](https://www.yard.nl/werken-bij/) diff --git a/resources/views/components/tooltip/index.blade.php b/resources/views/components/tooltip/index.blade.php new file mode 100644 index 0000000..0648904 --- /dev/null +++ b/resources/views/components/tooltip/index.blade.php @@ -0,0 +1,12 @@ +@props(['id', 'arrowClass' => '']) + +
merge([ + 'id' => $id, + 'role' => 'tooltip', + 'aria-hidden' => 'true', + 'class' => 'js-brave-tooltip', + ]) }}> + {{ $slot }} +
+
diff --git a/resources/views/components/tooltip/trigger.blade.php b/resources/views/components/tooltip/trigger.blade.php new file mode 100644 index 0000000..73ec03a --- /dev/null +++ b/resources/views/components/tooltip/trigger.blade.php @@ -0,0 +1,11 @@ +@props(['id', 'ariaDescribedby']) + + diff --git a/src/Components/Tooltip.php b/src/Components/Tooltip.php new file mode 100644 index 0000000..9805ca2 --- /dev/null +++ b/src/Components/Tooltip.php @@ -0,0 +1,17 @@ +name('components') ->hasConfigFile() ->hasViews('brave') - ->hasViewComponents('brave', Accordion::class, BackButton::class, Breadcrumb::class, Dialog::class, FeedbackForm::class, ImgFocalPoint::class, Nav::class, PatternContent::class, ReadSpeaker::class, SocialIcon::class); + ->hasViewComponents( + 'brave', + Accordion::class, + BackButton::class, + Breadcrumb::class, + Dialog::class, + FeedbackForm::class, + ImgFocalPoint::class, + Nav::class, + PatternContent::class, + ReadSpeaker::class, + SocialIcon::class, + Tooltip::class + ); } public function packageBooted(): void