Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions packages/core/src/Listbox/ListboxGroupLabel.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script lang="ts">
import type { PrimitiveProps } from '@/Primitive'

export interface ListboxGroupLabelProps extends PrimitiveProps {
for?: string
}
export interface ListboxGroupLabelProps extends PrimitiveProps {}
</script>

<script setup lang="ts">
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/Menu/MenuGroup.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
<script lang="ts">
import type { PrimitiveProps } from '@/Primitive'
import { createContext, useId } from '@/shared'

export interface MenuGroupProps extends PrimitiveProps {}

interface MenuGroupContext {
id: string
}

export const [injectMenuGroupContext, provideMenuGroupContext]
= createContext<MenuGroupContext>('MenuGroup')
</script>

<script setup lang="ts">
import { Primitive } from '@/Primitive'

const props = defineProps<MenuGroupProps>()

const id = useId(undefined, 'reka-listbox-group')

provideMenuGroupContext({ id })
</script>

<template>
<Primitive
role="group"
v-bind="props"
:aria-labelledby="id"
>
<slot />
</Primitive>
Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/Menu/MenuLabel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import type { PrimitiveProps } from '@/Primitive'
import { injectMenuGroupContext } from './MenuGroup.vue'

export interface MenuLabelProps extends PrimitiveProps {}
</script>
Expand All @@ -10,10 +11,15 @@ import { Primitive } from '@/Primitive'
const props = withDefaults(defineProps<MenuLabelProps>(), {
as: 'div',
})

const groupContext = injectMenuGroupContext({ id: '' })
</script>

<template>
<Primitive v-bind="props">
<Primitive
v-bind="props"
:id="groupContext.id"
>
<slot />
</Primitive>
</template>