Skip to main content
useParticipantIds(params?): string[]; Use it to render groups, grids, or lists of participant tiles. If no parameters are provided, the ids of all participants in the call are returned.

Parameters (optional)

An object with the following properties:
filter
string
'local' | 'remote' | 'screen' | 'owner' | 'record' | FilterParticipantsFunction, filters the list of participant ids according to the provided criteria
onActiveSpeakerChange
Function
Callback for the active-speaker-change event
onParticipantJoined
Function
Callback for the participant-joined event
onParticipantLeft
Function
Callback for the participant-left event
onParticipantUpdated
Function
Callback for the participant-updated event
sort
string
'joined_at' | 'session_id' | 'user_id' | 'user_name' | SortParticipantsFunction, sorts the list of participant ids according to the provided criteria
{
  "filter": "remote",
  "onActiveSpeakerChange": <Function>,
  "onParticipantJoined": <Function>,
  "onparticipantUpdated": <Function>,
  "sort": "joined_at",
}

Return value

Returns a string[] — an array of participant ids.

Example

import { useParticipant, useParticipantIds } from '@daily-co/daily-react';
import { useMemo } from 'react';

export const UseParticipantIdsDemo = () => {
  const participantIDs = useParticipantIds({ sort: 'joined_at' });
  const latestParticipantID = useMemo(
    () => participantIDs?.[participantIDs.length - 1],
    [participantIDs]
  );
  const latestParticipant = useParticipant(latestParticipantID);

  return (
    <div>Latest participant: {latestParticipant?.user_name ?? 'none'}</div>
  );
};

See also