import { Children, useEffect, useState } from 'react'; import type { SlideSyncEvent } from 'reveal.js'; import { Deck, Slide, Stack, Markdown, Fragment, Code, useReveal } from '@revealjs/react'; import 'reveal.js/reveal.css'; import 'reveal.js/theme/black.css'; import 'reveal.js/plugin/highlight/monokai.css'; import RevealHighlight from 'reveal.js/plugin/highlight'; import RevealNotes from 'reveal.js/plugin/notes'; const buttonStyle: React.CSSProperties = { padding: '0.55em 0.95em', fontSize: '0.7em', fontWeight: 600, lineHeight: 1.2, color: '#ffffff', background: 'rgba(8, 13, 24, 0.72)', border: '1px solid rgba(255, 255, 255, 0.4)', borderRadius: '0.35em', cursor: 'pointer', }; function NavigationControls() { const deck = useReveal(); return (
This slide updates only its own React-rendered HTML, without manually calling{' '}
sync or syncSlide.
Current count: {count}
Slide color: {slideColor}
React wrapper for reveal.js
Press down to navigate
{`
Vertical Stack
Press down to navigate
Stack Slide 2
Vertical navigation works!
`}
Vertical navigation works!
Components inside slides can access the reveal.js API via the useReveal() hook.
{`
const deck = useReveal();
function nextSlide() {
deck?.next();
}
`}
Add slides at runtime — sync() handles it
Dynamically added via React state
This appears first
Then this
And this gets highlighted
{`
This appears first
Then this
And this gets highlighted
`}
This slide is animated automatically
Auto-animate
This slide is animated automatically
This slide is animated automatically
Thanks for watching!