The approved answer keeps the CSS in cache and affects other modals, you can create an aura component and call your LWC component from there like,
Creating LWC component
QuickActionLWCWidth.html
<header class="slds-modal__header">
<h2 id="modalheading" class="slds-modal__title slds-hyphenate">
I am header
</h2>
</header>
<p>I am body content</p>
<footer class="slds-modal__footer">
<lightning-button
variant="neutral"
label="Cancel"
onclick={closeAction}
></lightning-button>
<lightning-button
variant="Brand"
label="Save"
onclick={handleSave}
></lightning-button>
</footer>
QuickActionLWCWidth.js
import { LightningElement, api } from "lwc";
export default class QuickActionLWCWidth extends LightningElement {
@api recordId;
closeAction() {
const closeModalEvent = new CustomEvent("modalclose");
this.dispatchEvent(closeModalEvent);
}
handleSave() {
const closeModalEvent = new CustomEvent("modalclose");
this.dispatchEvent(closeModalEvent);
}
}
QuickActionLWCWidth.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>54.0</apiVersion>
<isExposed>false</isExposed>
</LightningComponentBundle>
Now create aura component like,
QuickActionLWCWidthAura.cmp
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId">
<aura:html tag="style">
.cuf-content { padding: 0 0rem !important; } .slds-p-around--medium {
padding: 0rem !important; } .slds-modal__content{ height:unset !important;
max-height:unset !important; } .slds-modal__container{ max-width:80rem
!important; width:80% !important; }
</aura:html>
<c:quickActionLWCWidth
recordId="{!v.recordId}"
onmodalclose="{!c.handleClose}"
></c:quickActionLWCWidth>
</aura:component>
QuickActionLWCWidthAuraController.js
({
handleClose: function (component, event, helper) {
$A.get("e.force:refreshView").fire();
$A.get("e.force:closeQuickAction").fire();
}
});
Feel free to check more details on original post