Install the package
npm i @zextras/carbonio-ui-preview
Wrap your app with the PreviewManager
and the ThemeProvider
import { ThemeProvider } from "@zextras/carbonio-design-system";
import { PreviewManager } from "@zextras/carbonio-ui-preview";
// ...
<ThemeProvider>
<PreviewManager>
<App/>
</PreviewManager>
</ThemeProvider>
Init the preview from within your app
import { usePreview } from "@zextras/carbonio-ui-preview";
// ...
const { initPreview } = usePreview();
initPreview([
{
previewType: 'image',
id: 'id1',
src: '...'
},
{
previewType: 'pdf',
id: 'id2',
src: '...'
},
// ...
]);
And open the preview of an initialized item through its id
import { usePreview } from "@zextras/carbonio-ui-preview";
// ...
const { openPreview } = usePreview();
openPreview(id);
See the example app for a simple working example.
See the API Documentation to see the full list of the props available.
See Migration for hints about the migration to a major version.
- clone this repo
- install the dependencies
npm install
npm run build
Carbonio UI Preview - UI Preview library for Zextras Carbonio
Copyright (C) 2023 Zextras https://www.zextras.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 only of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see Licenses - GNU Project - Free Software Foundation
See COPYING file for the project license details
See THIRDPARTIES file for other licenses details
All non-software material (such as, for example, names, images, logos, sounds) is owned by Zextras s.r.l. and is licensed under CC-BY-NC-SA.
Where not specified, all source files owned by Zextras s.r.l. are licensed under AGPL-3.0-only