Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-react-uikit-v7.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
CometChatActionSheet is a base component used by higher-level components like CometChatMessageComposer to present attachment options, and by CometChatContextMenu for contextual actions. It renders as a modal overlay with a backdrop, focus trap, and keyboard navigation.
Minimal Render
.cometchat-action-sheet
Sub-Components
CometChatActionSheet is a compound component with four sub-components:
| Sub-component | Purpose |
|---|---|
Root | Modal overlay container. Provides context, backdrop, focus trap, and keyboard handling. |
Header | Optional header bar with title and close button. |
Layout | Arranges items in list (vertical) or grid (icon grid) mode. |
Item | A single action rendered as a button. |
Root
The outermost wrapper. Controls open/close state, renders the backdrop, traps focus, and handles Escape, ArrowUp/ArrowDown, Home/End key navigation.Header
Renders a title and optional close button. Passchildren for fully custom header content.
Layout
Arranges child items. Defaults tolist mode (vertical stack). Set mode="grid" for an icon grid.
- List mode
- Grid mode
Item
Renders a single action as a<button>. Displays icon, title, and optional subtitle (subtitle hidden in grid mode). Disabled items show reduced opacity and are not clickable.
Common Patterns
Grid mode with header
Conditionally disabled items
Custom header content
Keyboard Navigation
The action sheet is fully keyboard-accessible:| Key | Behavior |
|---|---|
Tab | Moves focus to the next focusable element (trapped within the sheet) |
Shift+Tab | Moves focus to the previous focusable element (wraps around) |
Escape | Closes the sheet and returns focus to the trigger element |
ArrowDown | Moves focus to the next item (wraps from last to first) |
ArrowUp | Moves focus to the previous item (wraps from first to last) |
Home | Moves focus to the first item |
End | Moves focus to the last item |
Enter / Space | Activates the focused item (native button behavior) |
CSS Architecture
The component uses CSS custom properties (design tokens) defined in@cometchat/chat-uikit-react/css-variables.css. The cascade:
- Global tokens set on the
.cometchatroot wrapper. - Component CSS (
.cometchat-action-sheet) consumes these tokens viavar(). - Overrides target
.cometchat-action-sheetdescendant selectors.
Key Selectors
| Target | Selector |
|---|---|
| Root container | .cometchat-action-sheet |
| Backdrop overlay | .cometchat-action-sheet__backdrop |
| Header bar | .cometchat-action-sheet__header |
| Header title | .cometchat-action-sheet__header-title |
| Close button | .cometchat-action-sheet__header-close-button |
| List layout | .cometchat-action-sheet__layout-list |
| Grid layout | .cometchat-action-sheet__layout-grid |
| Item (list mode) | .cometchat-action-sheet__item |
| Item (grid mode) | .cometchat-action-sheet__item--grid |
| Item icon | .cometchat-action-sheet__item-icon |
| Item title | .cometchat-action-sheet__item-title |
| Item subtitle | .cometchat-action-sheet__item-subtitle |
Example: Brand-themed action sheet
App.css
Customization Matrix
| What to change | Where | Property/API | Example |
|---|---|---|---|
| Open/close state | Component props | isOpen, onClose on Root | <Root isOpen={open} onClose={close}> |
| Layout mode | Component props | mode on Layout, layoutMode on Root | <Layout mode="grid"> |
| Header content | Component props | title, onClose, children on Header | <Header title="Actions"> |
| Disable an item | Item data | disabled on CometChatActionSheetItemData | { disabled: true } |
| Change visual styling | Global CSS | .cometchat-action-sheet selectors | See example above |
Props
All props are optional unless noted otherwise.CometChatActionSheet.Root
isOpen
Whether the action sheet is visible. Whenfalse, the component renders nothing.
| Type | boolean |
| Default | false |
onClose
Called when the user clicks the backdrop, presses Escape, or triggers a close action.| Type | () => void |
| Default | undefined |
layoutMode
Sets the layout mode passed to context. Sub-components likeItem read this to apply grid or list styling.
| Type | 'list' | 'grid' |
| Default | 'list' |
title
Optional title displayed in the header. When provided, the Root renders a built-in header with this title text.| Type | string |
| Default | undefined |
className
Custom CSS class appended to the root container.| Type | string |
| Default | undefined |
children
Content rendered inside the dialog. TypicallyHeader, Layout, and Item sub-components.
| Type | ReactNode |
| Default | undefined |
CometChatActionSheet.Header
title
Text displayed as the header title.| Type | string |
| Default | undefined |
onClose
Callback for the close button. If omitted, no close button is rendered.| Type | () => void |
| Default | undefined |
children
Custom header content. When provided, replaces the default title + close button layout.| Type | ReactNode |
| Default | undefined |
CometChatActionSheet.Layout
mode
Arrangement of child items.| Type | 'list' | 'grid' |
| Default | 'list' |
children
TheItem sub-components to render.
| Type | ReactNode |
| Default | undefined |
CometChatActionSheet.Item
item
The action item data object.| Type | CometChatActionSheetItemData |
| Default | undefined |
className
Custom CSS class appended to the item button.| Type | string |
| Default | undefined |
CSS Selectors
| Target | Selector |
|---|---|
| Root | .cometchat-action-sheet |
| Backdrop | .cometchat-action-sheet__backdrop |
| Header | .cometchat-action-sheet__header |
| Header title | .cometchat-action-sheet__header-title |
| Header close button | .cometchat-action-sheet__header-close-button |
| List layout | .cometchat-action-sheet__layout-list |
| Grid layout | .cometchat-action-sheet__layout-grid |
| Item (list) | .cometchat-action-sheet__item |
| Item (grid) | .cometchat-action-sheet__item--grid |
| Item icon | .cometchat-action-sheet__item-icon |
| Item title | .cometchat-action-sheet__item-title |
| Item subtitle | .cometchat-action-sheet__item-subtitle |