import { type InjectionKey, type ComputedRef } from 'vue' import { inject, computed } from 'vue' import type { GetObjectField } from '#ui/types/utils' import type { ButtonGroupProps } from '../components/ButtonGroup.vue' export const buttonGroupInjectionKey: InjectionKey> = Symbol('nuxt-ui.button-group') type Props = { size?: GetObjectField } export function useButtonGroup(props: Props) { const buttonGroup = inject(buttonGroupInjectionKey, undefined) return { orientation: computed(() => buttonGroup?.value.orientation), size: computed(() => props?.size ?? buttonGroup?.value.size) } }