Skip to content
Discussion options

You must be logged in to vote

@Jauki the radix select only allows string values because it applies your values to the native <select> options for a11y, and HTML can only have string values. instead it provides an onValueChange api so that you can derive the value:

const roomsMap = React.useMemo(() => new Map(rooms.map(room => [room.id, room])), [rooms]);
const { room, setRoom } = useRoom();

return (
  <Select.Root value={room.id} onValueChange={id => setRoom(roomsMap.get(id))}>
    <Select.Trigger>
      <Select.Icon>🌵</Select.Icon>
      <Select.Value placeholder='Select a room...' />
    </Select.Trigger>
    <Select.Content>
      <Select.Viewport>
        {rooms.map((room, k) => (
          <Select.Item key={room.id

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mamlzy
Comment options

@jjenzz
Comment options

Answer selected by benoitgrelard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants