How to disable "attach files" in the expanded composer in the ThreadedComment component?
I've looked at all of the options in these places:
https://docs.cord.com/components/cord-threaded-comments
https://docs.cord.com/js-apis-and-hooks/initialization
I'm not finding an option to disable "attach file".
![cord icon logo](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fcord-icon.19285d53.png&w=32&q=75)
Hey Ricky,
You are right there is no option for that.
But you can achieve this with the following steps:
1. hide the button with CSS, our components are covered by consistent and stable class names.
2. hide the attachments in the composer and message with CSS, in case someone actually tried hard to attach files.
3. hide the drag and drop overlay
.cord-button[data-cord-button=add-attachment],
.cord-component .cord-message-attachment,
.cord-component .cord-attachments,
.cord-component .cord-dnd-overlay {
display: none;
}
4. in beforeMessageCreate remove any attachments before sending them https://docs.cord.com/js-apis-and-hooks/initialization#beforeMessageCreate
cord.updateOptions({beforeMessageCreate : (msg) => {delete msg.addAttachments; return msg}})
I hope this help!
Thanks again for your quick response. I'm all set.