AdminPrintAction is a component used by admin print action extensions to denote a URL to print. Admin print action extensions require the use of this component.
import React from 'react';
import {
reactExtension,
AdminPrintAction,
Text,
} from '@shopify/ui-extensions-react/admin';
function App() {
return (
<AdminPrintAction src="https://example.com">
<Text>Modal content</Text>
</AdminPrintAction>
);
}
export default reactExtension(
'Playground',
() => <App />,
);
import {extension, AdminPrintAction, Text} from '@shopify/ui-extensions/admin';
export default extension('Playground', (root) => {
const adminPrintAction = root.createComponent(
AdminPrintAction,
{
src: 'https://example.com',
},
root.createComponent(Text, {fontWeight: 'bold'}, 'Modal content'),
);
root.append(adminPrintAction);
root.mount();
});
Sets the src URL of the preview and the document to print. If not provided, the preview will show an empty state and the print button will be disabled. HTML, PDFs and images are supported.