A comic/manga viewer component for React
npm install react-comic-viewerA comic/manga viewer component for React.
https://react-comic-viewer.kkweb.io
- RTL (right-to-left) and LTR support for manga/comic reading
- Responsive single/double page view
- Fullscreen mode
- Swipe navigation on touch devices
- Keyboard navigation (Arrow keys, Escape)
- Double-tap to zoom
- Tap to show/hide UI
- Thumbnail navigation
- Loading indicator
- Page preloading
- TypeScript support
- React 18 or later
``bash`
npm install react-comic-viewer
`tsx
import { ComicViewer } from "react-comic-viewer";
import "react-comic-viewer/styles.css";
function App() {
return (
);
}
export default App;
`
| Prop | Type | Default | Description |
| ------------------- | ---------------------------------------------------------- | ------- | ---------------------------------------------------- |
| pages | Array | - | Required. Array of image URLs or React nodes |"rtl" \| "ltr"
| direction | | "rtl" | Reading direction |number
| initialCurrentPage | | 0 | Initial page index |boolean
| initialIsExpansion | | false | Initial expansion state |boolean
| showPageIndicator | | false | Show current page indicator |number
| switchingRatio | | 1 | Aspect ratio threshold for single/double page switch |(currentPage: number) => void
| onChangeCurrentPage | | - | Callback when page changes |(isExpansion: boolean) => void
| onChangeExpansion | | - | Callback when expansion state changes |MouseEventHandler
| onClickCenter | | - | Callback when center area is clicked |Partial
| className | | - | Custom class names for styling |{ expansion?, fullScreen?, move?, normal?, thumbnails? }` | - | Custom text for UI buttons |
| text |
| Key | Action |
| ----------- | ------------------------------------- |
| Arrow Left | Next page (RTL) / Previous page (LTR) |
| Arrow Right | Previous page (RTL) / Next page (LTR) |
| Escape | Exit fullscreen |
| Gesture | Action |
| ----------- | -------------------- |
| Swipe left | Navigate pages |
| Swipe right | Navigate pages |
| Single tap | Toggle UI visibility |
| Double tap | Toggle zoom (2x) |
Full Screen API is not supported on iOS.
The fullscreen button will not be displayed on unsupported browsers.
MIT