Skip to content

Commit

Permalink
feat: add support for using tooltips on buttons that are inside a but…
Browse files Browse the repository at this point in the history
…ton group
  • Loading branch information
tho-dan committed Dec 10, 2024
1 parent 79b0c19 commit 788f73a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
29 changes: 29 additions & 0 deletions docs/components/tooltip.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import FwbTooltipExample from './tooltip/examples/FwbTooltipExample.vue'
import FwbTooltipExamplePosition from './tooltip/examples/FwbTooltipExamplePosition.vue'
import FwbTooltipExampleStyle from './tooltip/examples/FwbTooltipExampleStyle.vue'
import FwbTooltipExampleGroup from './tooltip/examples/FwbTooltipExampleGroup.vue'
import FwbTooltipExampleTrigger from './tooltip/examples/FwbTooltipExampleTrigger.vue'
</script>
# Vue Tooltip - Flowbite
Expand Down Expand Up @@ -117,6 +118,34 @@ import { FwbButton, FwbTooltip } from 'flowbite-vue'
</script>
```

## Inside of Button Group

You can use the tooltip component inside of the button group component.

<fwb-tooltip-example-group />
```vue
<template>
<fwb-button-group>
<fwb-button>
Normal Button
</fwb-button>
<fwb-tooltip>
<template #trigger>
<fwb-button>
Button With Tooltip
</fwb-button>
</template>
<template #content>
Tooltip content
</template>
</fwb-tooltip>
</fwb-button-group>
</template>
<script setup>
import { FwbButton, FwbButtonGroup, FwbTooltip } from '../../../../src/index'
</script>
```


## triggerType
Expand Down
23 changes: 23 additions & 0 deletions docs/components/tooltip/examples/FwbTooltipExampleGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div class="vp-raw">
<fwb-button-group>
<fwb-button>
Normal Button
</fwb-button>
<fwb-tooltip>
<template #trigger>
<fwb-button>
Button With Tooltip
</fwb-button>
</template>
<template #content>
Tooltip content
</template>
</fwb-tooltip>
</fwb-button-group>
</div>
</template>

<script setup>
import { FwbButton, FwbButtonGroup, FwbTooltip } from '../../../../src/index'
</script>
9 changes: 6 additions & 3 deletions src/components/FwbButtonGroup/FwbButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
</template>

<style>
.fwb-button-group > button {
.fwb-button-group > button,
.fwb-button-group > .fwb-tooltip button {
@apply rounded-none;
}
.fwb-button-group > button:first-child {
.fwb-button-group > button:first-child,
.fwb-button-group > .fwb-tooltip:first-child button {
@apply rounded-l-lg;
}
.fwb-button-group > button:last-child {
.fwb-button-group > button:last-child,
.fwb-button-group > .fwb-tooltip:last-child button {
@apply rounded-r-lg;
}
</style>
2 changes: 1 addition & 1 deletion src/components/FwbTooltip/FwbTooltip.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="flex items-start">
<div class="fwb-tooltip flex items-start">
<tooltip
:placement="placement"
:triggers="[trigger]"
Expand Down

0 comments on commit 788f73a

Please sign in to comment.