Skip to content

Commit 90c175a

Browse files
kricsleozernoniaclaude
authored
feat(Select/Listbox/Combobox/Menu/ContextMenu/DropdownMenu/Menubar/ColorSwatchPicker): add slot prop to *Item and forceMount to *ItemIndicator (#2562)
* feat(Select): add `selected` slot prop to `SelectItem` and `forceMount` to `SelectItemIndicator` * feat: add slot props/`forceMount` for more components * fix(Select,Listbox,Menu): address review on slot props and item indicators - stop forceMount leaking as a DOM attribute on Select/ListboxItemIndicator - add data-state to Select/ListboxItemIndicator for forceMount animations - expose checked from MenuCheckboxItem, matching radio items - add defineSlots to SelectItem, ColorSwatchPickerItem and menu wrappers - add tests and regenerate API docs Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: zernonia <59365435+zernonia@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 7235598 commit 90c175a

31 files changed

Lines changed: 531 additions & 41 deletions

‎docs/content/meta/ColorSwatchPickerItem.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
'type': '[event: SelectEvent&lt;AcceptableValue&gt;]'
3737
}
3838
]" />
39+
40+
<SlotsTable :data="[
41+
{
42+
'name': 'selected',
43+
'description': '<p>Whether the item is currently selected</p>\n',
44+
'type': 'boolean'
45+
}
46+
]" />
3947
</llm-exclude>
4048

4149
<llm-only>
@@ -55,4 +63,10 @@
5563
| --- | --- | --- |
5664
| `select` | Event handler called when the selecting item. <br> It can be prevented by calling event.preventDefault. | `[event: SelectEvent<AcceptableValue>]` |
5765

66+
**Slots**
67+
68+
| Name | Description | Type |
69+
| --- | --- | --- |
70+
| `selected` | Whether the item is currently selected | `boolean` |
71+
5872
</llm-only>

‎docs/content/meta/ColorSwatchPickerItemIndicator.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
'description': '<p>Change the default rendered element for the one passed as a child, merging their props and behavior.</p>\n<p>Read our <a href=\'https://www.reka-ui.com/docs/guides/composition\'>Composition</a> guide for more details.</p>\n',
1515
'type': 'boolean',
1616
'required': false
17+
},
18+
{
19+
'name': 'forceMount',
20+
'description': '<p>Used to force mounting when more control is needed. Useful when\ncontrolling animation with Vue animation libraries.</p>\n',
21+
'type': 'boolean',
22+
'required': false
1723
}
1824
]" />
1925
</llm-exclude>
@@ -26,5 +32,6 @@
2632
| --- | --- | --- | --- | --- |
2733
| `as` | The element or component this component should render as. Can be overwritten by asChild. | `AsTag \| Component` | No | `"div"` |
2834
| `asChild` | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | `boolean` | No | - |
35+
| `forceMount` | Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries. | `boolean` | No | - |
2936

3037
</llm-only>

‎docs/content/meta/ComboboxItem.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
'type': '[event: SelectEvent&lt;T&gt;]'
4343
}
4444
]" />
45+
46+
<SlotsTable :data="[
47+
{
48+
'name': 'selected',
49+
'description': '<p>Whether the item is currently selected</p>\n',
50+
'type': 'boolean'
51+
}
52+
]" />
4553
</llm-exclude>
4654

4755
<llm-only>
@@ -62,4 +70,10 @@
6270
| --- | --- | --- |
6371
| `select` | Event handler called when the selecting item. <br> It can be prevented by calling event.preventDefault. | `[event: SelectEvent<T>]` |
6472

73+
**Slots**
74+
75+
| Name | Description | Type |
76+
| --- | --- | --- |
77+
| `selected` | Whether the item is currently selected | `boolean` |
78+
6579
</llm-only>

‎docs/content/meta/ComboboxItemIndicator.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
'description': '<p>Change the default rendered element for the one passed as a child, merging their props and behavior.</p>\n<p>Read our <a href=\'https://www.reka-ui.com/docs/guides/composition\'>Composition</a> guide for more details.</p>\n',
1515
'type': 'boolean',
1616
'required': false
17+
},
18+
{
19+
'name': 'forceMount',
20+
'description': '<p>Used to force mounting when more control is needed. Useful when\ncontrolling animation with Vue animation libraries.</p>\n',
21+
'type': 'boolean',
22+
'required': false
1723
}
1824
]" />
1925
</llm-exclude>
@@ -26,5 +32,6 @@
2632
| --- | --- | --- | --- | --- |
2733
| `as` | The element or component this component should render as. Can be overwritten by asChild. | `AsTag \| Component` | No | `"span"` |
2834
| `asChild` | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | `boolean` | No | - |
35+
| `forceMount` | Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries. | `boolean` | No | - |
2936

3037
</llm-only>

‎docs/content/meta/ContextMenuCheckboxItem.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@
4747
'type': '[payload: boolean]'
4848
}
4949
]" />
50+
51+
<SlotsTable :data="[
52+
{
53+
'name': 'checked',
54+
'description': '<p>Current checked state</p>\n',
55+
'type': 'false | true | \'indeterminate\''
56+
},
57+
{
58+
'name': 'modelValue',
59+
'description': '<p>Current modelValue state</p>\n',
60+
'type': 'CheckedState'
61+
}
62+
]" />
5063
</llm-exclude>
5164

5265
<llm-only>
@@ -68,4 +81,11 @@
6881
| `select` | Event handler called when the user selects an item (via mouse or keyboard). <br> Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item. | `[event: Event]` |
6982
| `update:modelValue` | Event handler called when the value changes. | `[payload: boolean]` |
7083

84+
**Slots**
85+
86+
| Name | Description | Type |
87+
| --- | --- | --- |
88+
| `checked` | Current checked state | `false \| true \| "indeterminate"` |
89+
| `modelValue` | Current modelValue state | `CheckedState` |
90+
7191
</llm-only>

‎docs/content/meta/ContextMenuRadioItem.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
'type': '[event: Event]'
4343
}
4444
]" />
45+
46+
<SlotsTable :data="[
47+
{
48+
'name': 'checked',
49+
'description': '<p>Current checked state</p>\n',
50+
'type': 'boolean'
51+
}
52+
]" />
4553
</llm-exclude>
4654

4755
<llm-only>
@@ -62,4 +70,10 @@
6270
| --- | --- | --- |
6371
| `select` | Event handler called when the user selects an item (via mouse or keyboard). <br> Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item. | `[event: Event]` |
6472

73+
**Slots**
74+
75+
| Name | Description | Type |
76+
| --- | --- | --- |
77+
| `checked` | Current checked state | `boolean` |
78+
6579
</llm-only>

‎docs/content/meta/DropdownMenuCheckboxItem.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@
4747
'type': '[payload: boolean]'
4848
}
4949
]" />
50+
51+
<SlotsTable :data="[
52+
{
53+
'name': 'checked',
54+
'description': '<p>Current checked state</p>\n',
55+
'type': 'false | true | \'indeterminate\''
56+
},
57+
{
58+
'name': 'modelValue',
59+
'description': '<p>Current modelValue state</p>\n',
60+
'type': 'CheckedState'
61+
}
62+
]" />
5063
</llm-exclude>
5164

5265
<llm-only>
@@ -68,4 +81,11 @@
6881
| `select` | Event handler called when the user selects an item (via mouse or keyboard). <br> Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item. | `[event: Event]` |
6982
| `update:modelValue` | Event handler called when the value changes. | `[payload: boolean]` |
7083

84+
**Slots**
85+
86+
| Name | Description | Type |
87+
| --- | --- | --- |
88+
| `checked` | Current checked state | `false \| true \| "indeterminate"` |
89+
| `modelValue` | Current modelValue state | `CheckedState` |
90+
7191
</llm-only>

‎docs/content/meta/DropdownMenuRadioItem.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
'type': '[event: Event]'
4343
}
4444
]" />
45+
46+
<SlotsTable :data="[
47+
{
48+
'name': 'checked',
49+
'description': '<p>Current checked state</p>\n',
50+
'type': 'boolean'
51+
}
52+
]" />
4553
</llm-exclude>
4654

4755
<llm-only>
@@ -62,4 +70,10 @@
6270
| --- | --- | --- |
6371
| `select` | Event handler called when the user selects an item (via mouse or keyboard). <br> Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item. | `[event: Event]` |
6472

73+
**Slots**
74+
75+
| Name | Description | Type |
76+
| --- | --- | --- |
77+
| `checked` | Current checked state | `boolean` |
78+
6579
</llm-only>

‎docs/content/meta/ListboxItem.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
'type': '[event: SelectEvent&lt;T&gt;]'
3737
}
3838
]" />
39+
40+
<SlotsTable :data="[
41+
{
42+
'name': 'selected',
43+
'description': '<p>Whether the item is currently selected</p>\n',
44+
'type': 'boolean'
45+
}
46+
]" />
3947
</llm-exclude>
4048

4149
<llm-only>
@@ -55,4 +63,10 @@
5563
| --- | --- | --- |
5664
| `select` | Event handler called when the selecting item. <br> It can be prevented by calling event.preventDefault. | `[event: SelectEvent<T>]` |
5765

66+
**Slots**
67+
68+
| Name | Description | Type |
69+
| --- | --- | --- |
70+
| `selected` | Whether the item is currently selected | `boolean` |
71+
5872
</llm-only>

‎docs/content/meta/ListboxItemIndicator.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
'description': '<p>Change the default rendered element for the one passed as a child, merging their props and behavior.</p>\n<p>Read our <a href=\'https://www.reka-ui.com/docs/guides/composition\'>Composition</a> guide for more details.</p>\n',
1515
'type': 'boolean',
1616
'required': false
17+
},
18+
{
19+
'name': 'forceMount',
20+
'description': '<p>Used to force mounting when more control is needed. Useful when\ncontrolling animation with Vue animation libraries.</p>\n',
21+
'type': 'boolean',
22+
'required': false
1723
}
1824
]" />
1925
</llm-exclude>
@@ -26,5 +32,6 @@
2632
| --- | --- | --- | --- | --- |
2733
| `as` | The element or component this component should render as. Can be overwritten by asChild. | `AsTag \| Component` | No | `"span"` |
2834
| `asChild` | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | `boolean` | No | - |
35+
| `forceMount` | Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries. | `boolean` | No | - |
2936

3037
</llm-only>

0 commit comments

Comments
 (0)