useParticipantTile
function useParticipantTile<T>(options): {
elementProps: ParticipantTileElementProps<T>;
};Defined in: packages/react/src/hooks/participant/useParticipantTile.ts:51
The useParticipantTile hook is used to implement the ParticipantTile and returns the props needed to render the tile.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | TrackSource |
Parameters
| Parameter | Type |
|---|---|
options | UseParticipantTileOptions |
Returns
{
elementProps: ParticipantTileElementProps<T>;
}elementProps
elementProps: ParticipantTileElementProps<T>;Example
// Basic — get element props for a participant tile.
const { elementProps } = useParticipantTile({ htmlProps: {} });
// Advanced — wire tile props and click handling to a track reference.
function CustomParticipantTile({ trackRef }: { trackRef: TrackReferenceOrPlaceholder }) {
const { elementProps } = useParticipantTile({
trackRef,
htmlProps: { className: "participant-tile" },
onParticipantClick: (event) => console.log(event),
});
return <div {...elementProps}><ParticipantTile trackRef={trackRef} /></div>;
}