Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions docs/components/button-group.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import FwbButtonGroupExample from './buttonGroup/examples/FwbButtonGroupExample.vue'
import FwbButtonGroupExampleIcon from './buttonGroup/examples/FwbButtonGroupExampleIcon.vue'
import FwbButtonGroupExample from './buttonGroup/examples/FwbButtonGroupExample.vue';
import FwbButtonGroupExampleIcon from './buttonGroup/examples/FwbButtonGroupExampleIcon.vue';
import FwbButtonGroupExampleDropdown from './buttonGroup/examples/FwbButtonGroupExampleDropdown.vue';
</script>

# Vue Button Group - Flowbite
Expand Down Expand Up @@ -57,3 +58,36 @@ import { FwbButtonGroup, FwbButton } from 'flowbite-vue'
import { FwbButtonGroup, FwbButton } from 'flowbite-vue'
</script>
```

## Grouping buttons and dropdowns

You can also mix buttons with dropdowns inside the button group.
<fwb-button-group-example-dropdown />
```vue
<template>
<fwb-button-group>
<fwb-button>Button 1</fwb-button>
<fwb-button>Button 2</fwb-button>
<fwb-dropdown text="Dropdown">
<p class="px-4">
This is a test dropdown
</p>
</fwb-dropdown>
<fwb-dropdown text="Dropdown with list">
<fwb-list-group>
<fwb-list-group-item
v-for="item in ['This', 'is', 'a', 'list']"
:key="item"
hover
>
<a href="#">{{ item }}</a>
</fwb-list-group-item>
</fwb-list-group>
</fwb-dropdown>
</fwb-button-group>
</template>

<script setup>
import { FwbButtonGroup, FwbButton, FwbDropdown, FwbListGroupItem, FwbListGroup } from 'flowbite-vue'
</script>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div class="vp-raw">
<fwb-button-group>
<fwb-button> Button 1 </fwb-button>
<fwb-button> Button 2 </fwb-button>
<fwb-dropdown text="Dropdown">
<p class="px-4">
This is a test dropdown
</p>
</fwb-dropdown>
<fwb-dropdown text="Dropdown with list">
<fwb-list-group>
<fwb-list-group-item
v-for="item in ['This', 'is', 'a', 'list']"
:key="item"
hover
>
<a href="#">{{ item }}</a>
</fwb-list-group-item>
</fwb-list-group>
</fwb-dropdown>
</fwb-button-group>
</div>
</template>

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

<style>
.fwb-button-group > button {
.fwb-button-group > button,
.fwb-button-group > .fwb-dropdown button {
@apply rounded-none;
}
.fwb-button-group > button:first-child {

.fwb-button-group > button:first-child,
.fwb-button-group > .fwb-dropdown:first-child button {
@apply rounded-l-lg;
}
.fwb-button-group > button:last-child {

.fwb-button-group > button:last-child,
.fwb-button-group > .fwb-dropdown:last-child button {
@apply rounded-r-lg;
}
</style>
2 changes: 1 addition & 1 deletion src/components/FwbDropdown/FwbDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
ref="wrapper"
class="inline-flex relative"
class="fwb-dropdown inline-flex relative"
>
<div class="inline-flex items-center">
<fwb-slot-listener @click="onToggle">
Expand Down