Admin Print Action
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.
Anchor to adminprintactionpropsAdminPrintActionProps
- string
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.
AdminPrintActionProps
- src
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.
string
export interface AdminPrintActionProps {
/**
* 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.
*/
src?: string;
}
Was this section helpful?
Set the source URL of the print action extension.
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 />,
);
examples
Set the source URL of the print action extension.
React
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 />, );
JS
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(); });
Preview
