Skip to content

Commit

Permalink
docs: add info about css exports
Browse files Browse the repository at this point in the history
  • Loading branch information
cyntler committed Jun 7, 2024
1 parent 4720bbd commit b06d77b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,22 @@ Use one of the package managers for Node.js.

> **Warning:** _By default the component height will expand and contract to the current loaded file. The width will expand to fill the parent._
### Required styles

The library exports a CSS file containing classes needed for correct rendering of e.g. PDF files. It is best to include it at the beginning of the application or in the place where you use this library.

```tsx
import "@cyntler/react-doc-viewer/dist/index.css";
```

### Basic

DocViewer requires at least an array of document objects to function.
Each document object must have a uri to a file, either a url that returns a file or a local file.

```tsx
import DocViewer, { DocViewerRenderers } from "@cyntler/react-doc-viewer";
import "@cyntler/react-doc-viewer/dist/index.css";

function App() {
const docs = [
Expand All @@ -111,6 +120,7 @@ By default, the first item in your `documents` array will be displayed after the

```tsx
import DocViewer, { DocViewerRenderers } from "@cyntler/react-doc-viewer";
import "@cyntler/react-doc-viewer/dist/index.css";

const App = () => {
const docs = [
Expand Down Expand Up @@ -194,6 +204,7 @@ To use the included renderers.
```tsx
import DocViewer, { DocViewerRenderers } from "@cyntler/react-doc-viewer";
import "@cyntler/react-doc-viewer/dist/index.css";

<DocViewer
pluginRenderers={DocViewerRenderers}
Expand All @@ -205,6 +216,7 @@ Or you can import individual renderers.
```tsx
import DocViewer, { PDFRenderer, PNGRenderer } from "@cyntler/react-doc-viewer";
import "@cyntler/react-doc-viewer/dist/index.css";

<DocViewer
pluginRenderers={[PDFRenderer, PNGRenderer]}
Expand Down Expand Up @@ -240,6 +252,7 @@ And supply it to `pluginRenderers` inside an `Array`.
```tsx
import DocViewer, { DocViewerRenderers } from "@cyntler/react-doc-viewer";
import "@cyntler/react-doc-viewer/dist/index.css";

<DocViewer
pluginRenderers={[MyCustomPNGRenderer]}
Expand Down

0 comments on commit b06d77b

Please sign in to comment.