Building block for conversations pinned to a place
The Pin
component is a building block for creating conversations pinned to a particular place on your page. This component lets you create features similar to Floating Threads
. Compared to Floating threads
thePin
component is a lower-level primitive that offers more flexibility in customizability and functionality.
Every Pin
corresponds to a single conversation thread like the Thread
component. The Pin
shows the avatar of the user who created the thread. It also changes color based on whether the conversation contains unread messages.
Most commonly, the Thread
component is rendered next to the Pin
, opening and closing the Thread
when user clicks the Pin
. See example below.
This component pairs well with:
import { Thread } from "@cord-sdk/react";
export const Example = () => {
const [open, setOpen] = useState(false);
return (
<Pin
location={{ page: "index" }}
threadId={"<threadId>"}
onClick={() => setOpen((x) => !x)}
>
<Thread
location={{ page: "index" }}
threadId={"<threadId>"}
style={{ left: '0px',
position: 'absolute',
top: '100%',
visibility: open ? "visible" : "hidden",
}}
/>
</Pin>
);
};
threadId
see the documentation for
Thread component.ThreadSummary
(or null
in the rare case of the event happening before
the thread information is loaded).threadId
is resolved.
The argument to this callback will be of type
ThreadSummary
(or null
in the rare case of the event happening before
the thread information is loaded).ThreadSummary
(or null
in the rare case of the event happening before
the thread information is loaded).ThreadSummary
(or null
in the rare case of the event happening before
the thread information is loaded).If you want to customize this component, you can target the classes below in your app's CSS. These are guaranteed to be stable.
This component itself makes use of the Avatar component. Take a look at its documentation for what classes are available to target within it.
.cord-pin-container
Not finding the answer you need? Ask our Developer Community