@@ -249,15 +249,16 @@ Use the `renderValue` prop to provide a custom element to display selected items
249249
250250``` tsx render
251251" use client" ;
252- import {Avatar , Picker , PickerItem , Text } from ' @react-spectrum/s2' ;
253- import {style } from ' @react-spectrum/s2/style' with {type: ' macro' };
252+ import {Avatar , AvatarGroup , Picker , PickerItem , Text } from ' @react-spectrum/s2' ;
254253
254+ // /- begin collapse -///
255255let users = [
256256 {id: ' abraham-baker' , avatar: ' https://www.untitledui.com/images/avatars/abraham-baker' , name: ' Abraham Baker' , email: ' abraham@example.com' },
257257 {id: ' adriana-sullivan' , avatar: ' https://www.untitledui.com/images/avatars/adriana-sullivan' , name: ' Adriana Sullivan' , email: ' adriana@example.com' },
258258 {id: ' jonathan-kelly' , avatar: ' https://www.untitledui.com/images/avatars/jonathan-kelly' , name: ' Jonathan Kelly' , email: ' jonathan@example.com' },
259259 {id: ' zara-bush' , avatar: ' https://www.untitledui.com/images/avatars/zara-bush' , name: ' Zara Bush' , email: ' zara@example.com' }
260260];
261+ // /- end collapse -///
261262
262263function Example() {
263264 return (
@@ -268,11 +269,11 @@ function Example() {
268269 selectionMode = { " multiple" }
269270 // /- begin highlight -///
270271 renderValue = { (selectedItems ) => (
271- <div className = { style ({ display: ' flex ' , gap: 4 , height: ' 80% ' }) } >
272+ <AvatarGroup aria-label = " Selected users " >
272273 { selectedItems .map (item => (
273- <Avatar slot = { null } key = { item .id } src = { item .avatar } alt = { item .name } />
274+ <Avatar key = { item .id } src = { item .avatar } alt = { item .name } />
274275 ))}
275- </div >
276+ </AvatarGroup >
276277 )}
277278 // /- end highlight -///
278279 >
0 commit comments