> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-react-v7-feature-guides.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Collaborative Document Bubble

> A self-extracting bubble that renders a collaborative document card with a banner and an 'Open Document' button.

<Accordion title="AI Integration Quick Reference">
  | Field          | Value                                                                                                                                                                                                                        |
  | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Component      | `CometChatCollaborativeDocumentBubble`                                                                                                                                                                                       |
  | Package        | `@cometchat/chat-uikit-react`                                                                                                                                                                                                |
  | Import         | `import { CometChatCollaborativeDocumentBubble } from "@cometchat/chat-uikit-react";`                                                                                                                                        |
  | CSS root class | `.cometchat-collaborative-bubble`                                                                                                                                                                                            |
  | Primary output | `onButtonClick: (url: string) => void` — opens the document URL (defaults to `window.open`)                                                                                                                                  |
  | Prerequisites  | App wrapped in [`CometChatProvider`](/ui-kit/react/cometchat-provider) with valid credentials + a logged-in user; plus the [Collaborative Document extension](/fundamentals/collaborative-document) enabled in the Dashboard |
  | Stitching      | None — self-extracting from the SDK message                                                                                                                                                                                  |
  | Full props     | See [Props](#props)                                                                                                                                                                                                          |
</Accordion>

## Overview

`CometChatCollaborativeDocumentBubble` renders a collaborative document card — a banner image, a title, a subtitle, and an "Open Document" button. It is **self-extracting**: pass the SDK `message` and the bubble reads the document URL from the message's extension metadata (`@injected.extensions.document.document_url`), so it works standalone. Clicking the button opens the document (by default in a new window).

<Note>
  **Requires the Collaborative Document extension enabled in the [CometChat Dashboard](/fundamentals/collaborative-document).** Document messages (`extension_document`) — and the injected `document_url` this bubble reads — are only produced once the extension is turned on for your app. Without it the composer cannot create documents and this bubble never renders. See the [Collaborative Document guide](/fundamentals/collaborative-document) to enable it, and the [Plugins overview](/ui-kit/react/plugins/overview#built-in-plugins) for how the UI Kit auto-routes document messages to this bubble.
</Note>

<Info>
  **Live Preview** — interact with the collaborative document bubble.

  [Open in Storybook ↗](https://storybook.cometchat.io/react/?path=/story/components-bubbles-message-bubble--collaborative-document-message)
</Info>

<iframe src="https://storybook.cometchat.io/react/iframe.html?id=components-bubbles-message-bubble--collaborative-document-message&viewMode=story&shortcuts=false&singleStory=true" className="w-full rounded-xl" loading="lazy" style={{height: "600px", border: "1px solid #e0e0e0"}} title="CometChat Collaborative Document Bubble — Default" allow="clipboard-write" />

***

## Usage

```tsx theme={null}
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatCollaborativeDocumentBubble } from "@cometchat/chat-uikit-react";

function DocumentMessage({ message }: { message: CometChat.BaseMessage }) {
  return <CometChatCollaborativeDocumentBubble message={message} />;
}
```

***

## Props

### message

The collaborative-document message. The bubble extracts the URL from its metadata. **Required.**

|          |                         |
| -------- | ----------------------- |
| Type     | `CometChat.BaseMessage` |
| Required | Yes                     |

***

### alignment

Override incoming/outgoing alignment. Defaults to sender-vs-logged-in-user.

|         |                     |
| ------- | ------------------- |
| Type    | `"left" \| "right"` |
| Default | derived             |

***

### onButtonClick

Click handler for the action button. Receives the document URL. Defaults to `window.open`.

|         |                         |
| ------- | ----------------------- |
| Type    | `(url: string) => void` |
| Default | `window.open`           |

***

### disabled

Disable the action button (e.g. for a thread header preview).

|         |           |
| ------- | --------- |
| Type    | `boolean` |
| Default | `false`   |

***

### className

Additional CSS class applied to the root element.

|         |             |
| ------- | ----------- |
| Type    | `string`    |
| Default | `undefined` |

***

## CSS Selectors

| Target              | Selector                                                                                  |
| ------------------- | ----------------------------------------------------------------------------------------- |
| Root                | `.cometchat-collaborative-bubble`                                                         |
| Document modifier   | `.cometchat-collaborative-bubble--document`                                               |
| Incoming / outgoing | `.cometchat-collaborative-bubble--incoming` / `.cometchat-collaborative-bubble--outgoing` |
| Banner image        | `.cometchat-collaborative-bubble__banner-image`                                           |
| Title               | `.cometchat-collaborative-bubble__body-content-name`                                      |
| Subtitle            | `.cometchat-collaborative-bubble__body-content-description`                               |
| Open button         | `.cometchat-collaborative-bubble__button`                                                 |

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Collaborative Document Plugin" icon="file-pen" href="/ui-kit/react/plugins/overview#built-in-plugins">
    Plugin behavior, context menu, and conversation preview
  </Card>

  <Card title="Enable Collaborative Document (Dashboard)" icon="file-pen" href="/fundamentals/collaborative-document">
    Turn on the extension that produces these messages
  </Card>

  <Card title="Collaborative Whiteboard Bubble" icon="chalkboard" href="/ui-kit/react/components/collaborative-whiteboard-bubble">
    Render collaborative whiteboard messages
  </Card>

  <Card title="Message Bubble" icon="comment" href="/ui-kit/react/components/message-bubble">
    The wrapper that hosts bubble content
  </Card>

  <Card title="Theming" icon="paintbrush" href="/ui-kit/react/theming">
    Customize colors, fonts, and spacing
  </Card>
</CardGroup>
