Skip to content

Commit

Permalink
fix(ButtonGroup): nested group elements (#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
connerblanton committed Mar 17, 2024
1 parent e736eca commit 7658211
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/runtime/composables/useButtonGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ export function useProvideButtonGroup (buttonGroupProps: ButtonGroupProps) {
export function useInjectButtonGroup ({ ui, props }: { ui: any, props: any }) {
const instance = getCurrentInstance()

provide('ButtonGroupContextConsumer', true)
const isParentPartOfGroup = inject('ButtonGroupContextConsumer', false)

// early return if a parent is already part of the group
if (isParentPartOfGroup) {
return {
size: computed(() => props.size),
rounded: computed(() => ui.value.rounded)
}
}

let parent = instance.parent
let groupContext: Ref<ButtonGroupContext> | undefined

Expand Down

0 comments on commit 7658211

Please sign in to comment.