word-viewer
v0.1.4
Published
A lightweight web component for viewing and interacting with word documents.
Readme
Word Viewer Plugin
A lightweight web component for viewing and interacting with word documents.
Installation
npm install word-viewerUsage
Basic Usage
<script type="module">
import 'word-viewer';
</script>
<word-viewer></word-viewer>React Integration
Use it in your React components:
import React from 'react';
import { createComponent } from '@lit/react';
import { WordView } from 'word-viewer';
const WordViewerReact = createComponent({
react: React,
tagName: 'word-viewer',
elementClass: WordView
});
function App() {
return (
<div>
<h1>My Document Viewer</h1>
<WordViewerReact words="Edison Devadoss" />
</div>
);
}
export default App;Properties
| Property | Type | Description |
|----------|------|-------------|
| src | string | URL of the word document to display |
| theme | string | Theme of the viewer (light/dark) |
Events
| Event | Description |
|-------|-------------|
| load | Fired when the document is loaded |
| error | Fired when there's an error loading the document |
Browser Support
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
