How do you configure and build custom screen actions or quick actions using Lightning Web Components?
Answer
Basics: Quick actions are buttons on record pages. A screen action opens a modal containing your component; a headless action runs code immediately with no UI (for example clone a record or call Apex). Note: lightning/actions is a module for events such as CloseActionScreenEvent; it does not contain wire adapters.
How it works: Metadata: in .js-meta.xml set isExposed true, target lightning__RecordAction, and <targetConfig targets="lightning__RecordAction"><actionType>ScreenAction</actionType></targetConfig>. In the component, declare @api recordId (and @api objectApiName). Setup: Object Manager > object > Buttons, Links, and Actions > New Action > Action Type "Lightning Web Component" > choose the component, label it, save; then add it to the layout under "Salesforce Mobile and Lightning Experience Actions" (or a Lightning page's highlights panel). For a headless action, export @api invoke(); it runs on click.
Advanced / deep dive: To close the modal from a screen action, dispatch new CloseActionScreenEvent() imported from lightning/actions. After changing data, refresh the page with RefreshEvent from lightning/refresh or notifyRecordUpdateAvailable. The modal's title comes from the action label, and Salesforce renders the header and Cancel chrome; for full control or custom footers, avoid trying to build your own modal inside a screen action. recordId may not be set during connectedCallback, so rely on a setter or @wire with $recordId. Headless actions cannot show UI beyond toasts, and invoke() may run each time the button is clicked, so make it idempotent and guard against double-clicks. These LWC actions are for Lightning Experience and the mobile app; support in Experience Cloud is limited, so verify.