Skip to content

Commit 1fa554f

Browse files
authored
feat: add support for using tooltips on buttons that are inside a button group (#336)
1 parent 41334f8 commit 1fa554f

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

docs/components/tooltip.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import FwbTooltipExample from './tooltip/examples/FwbTooltipExample.vue'
33
import FwbTooltipExamplePosition from './tooltip/examples/FwbTooltipExamplePosition.vue'
44
import FwbTooltipExampleStyle from './tooltip/examples/FwbTooltipExampleStyle.vue'
5+
import FwbTooltipExampleGroup from './tooltip/examples/FwbTooltipExampleGroup.vue'
56
import FwbTooltipExampleTrigger from './tooltip/examples/FwbTooltipExampleTrigger.vue'
67
</script>
78
# Vue Tooltip - Flowbite
@@ -117,6 +118,34 @@ import { FwbButton, FwbTooltip } from 'flowbite-vue'
117118
</script>
118119
```
119120

121+
## Inside of Button Group
122+
123+
You can use the tooltip component inside of the button group component.
124+
125+
<fwb-tooltip-example-group />
126+
```vue
127+
<template>
128+
<fwb-button-group>
129+
<fwb-button>
130+
Normal Button
131+
</fwb-button>
132+
<fwb-tooltip>
133+
<template #trigger>
134+
<fwb-button>
135+
Button With Tooltip
136+
</fwb-button>
137+
</template>
138+
<template #content>
139+
Tooltip content
140+
</template>
141+
</fwb-tooltip>
142+
</fwb-button-group>
143+
</template>
144+
145+
<script setup>
146+
import { FwbButton, FwbButtonGroup, FwbTooltip } from '../../../../src/index'
147+
</script>
148+
```
120149

121150

122151
## triggerType
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div class="vp-raw">
3+
<fwb-button-group>
4+
<fwb-button>
5+
Normal Button
6+
</fwb-button>
7+
<fwb-tooltip>
8+
<template #trigger>
9+
<fwb-button>
10+
Button With Tooltip
11+
</fwb-button>
12+
</template>
13+
<template #content>
14+
Tooltip content
15+
</template>
16+
</fwb-tooltip>
17+
</fwb-button-group>
18+
</div>
19+
</template>
20+
21+
<script setup>
22+
import { FwbButton, FwbButtonGroup, FwbTooltip } from '../../../../src/index'
23+
</script>

src/components/FwbButtonGroup/FwbButtonGroup.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
</template>
99

1010
<style>
11-
.fwb-button-group > button {
11+
.fwb-button-group > button,
12+
.fwb-button-group > .fwb-tooltip button {
1213
@apply rounded-none;
1314
}
14-
.fwb-button-group > button:first-child {
15+
.fwb-button-group > button:first-child,
16+
.fwb-button-group > .fwb-tooltip:first-child button {
1517
@apply rounded-l-lg;
1618
}
17-
.fwb-button-group > button:last-child {
19+
.fwb-button-group > button:last-child,
20+
.fwb-button-group > .fwb-tooltip:last-child button {
1821
@apply rounded-r-lg;
1922
}
2023
</style>

src/components/FwbTooltip/FwbTooltip.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="flex items-start">
2+
<div class="fwb-tooltip flex items-start">
33
<tooltip
44
:placement="placement"
55
:triggers="[trigger]"

0 commit comments

Comments
 (0)