X Enterprises
nuxt-x-affiliate

Print Button

Print button — calls window.print() or prints just a scoped element selector.

Print Button

The XAFPrintButton component is a small button that triggers the browser's print dialog. Optionally takes a CSS selector to print just one element on the page (cloning it into an isolated container, printing, then restoring the original DOM).

Components

<XAFPrintButton />

<XAFPrintButton />
<XAFPrintButton label="Print this article" scope-selector="article" />

Props

PropTypeDefaultDescription
labelstring"Print / Save as PDF"Button label.
scopeSelectorstringIf provided, print only this element (e.g. "article"). Falls back to window.print() if the selector doesn't match.
showIconbooleantrueShow the printer emoji icon.

The scoped-print path clones the target element into a fresh <div id="xaf-print-container">, calls window.print(), then restores the original body. The page is reloaded after print to reset any styling state — accept this trade-off if you need scoped printing.


AI Context

component: XAFPrintButton
package: "@xenterprises/nuxt-x-affiliate"
use-when: Print button — window.print() for whole page, or scoped element print via CSS selector.
Copyright © 2026