βš›οΈβ€‚React API

Which component or hook do I import, and what does it take?

The structural components live in @getnarro/core. Full prop tables for every component are in the component reference, which is generated from the types; this page covers the shape of the API and how the pieces fit.

Presentation

The root container. Owns navigation, routing, keyboard and pointer handling, and viewport scaling.

import { Presentation } from "@getnarro/core";

<Presentation
  aspectRatio="16:9"
  keyboard
  mouse
  touch
  routing
  onSlideChange={(index) => console.log(index)}
>
  {/* slides */}
</Presentation>;
PropTypeDefault
childrenReactNodeβ€”
aspectRatioAspectRatio"16:9"
autoPlaynumber | boolean | number[]false
autoPlayLoopbooleanfalse
baseHeightnumber1080
baseWidthnumber1920
classNamestringβ€”
embeddedbooleanfalse
enableViewportScalingbooleantrue
faviconstring | nullβ€”
initialSlidenumber0
keepAwakebooleanfalse
keyboardbooleantrue
maxDurationnumberβ€”
mousebooleantrue
onAutoPlayComplete(() => void)β€”
onSlideChange((index: number) => void)β€”
onSlidesData((slides: SlideData[]) => void)β€”
preserveAspectRatiobooleantrue
routingbooleantrue
showAutoPlayIndicatorbooleanfalse
syncPresentationSyncfalse
themePresentationThemeβ€”
touchbooleantrue
transformTransformConfigβ€”

Slide

One slide. Give it an id if you want it linkable and stable across edits.

<Slide id="intro" layout="title" className="bg-slate-900" transition="fade">
  {/* content */}
</Slide>

layout is β€œdefault” | β€œcenter” | β€œtwo-column” | β€œimage” | β€œtitle”. transition is β€œnone” | β€œfade” | β€œslide” | β€œzoom”.

SlideContent

Handles padding and vertical alignment inside a slide.

<SlideContent layout="centered">{/* content */}</SlideContent>

layout here is β€œdefault” | β€œcentered” | β€œtop” | β€œbottom” | β€œfill” | β€œbetween” β€” a different set from Slide’s layout. The two are easy to confuse; Slide positions the slide, SlideContent positions the content within it.

Notes

Speaker notes. Renders nothing on the slide.

<Slide id="intro">
  <SlideContent>…</SlideContent>
  <Notes>Open with the customer story, then the numbers.</Notes>
</Slide>

Hooks

All hooks must be called inside a <Presentation>.

import { useNavigation } from "@getnarro/core";

function ProgressBar() {
  const { currentSlide, totalSlides, next, previous, goToSlideById } = useNavigation();

  return <div style={{ width: `${((currentSlide + 1) / totalSlides) * 100}%` }} />;
}

useNavigation() returns the navigation state and its actions together:

State β€” currentSlide, totalSlides, currentFragment, totalFragments, currentSubSlide, totalSubSlides, isFirst, isLast, isOverviewMode, isFullscreen.

Actions β€” next(), previous(), goToSlide(index), goToSlideById(id), toggleFullscreen(), toggleOverviewMode(), toggleAspectRatio().

Other exported hooks:

HookFor
usePresentationContext()The raw { state, actions } pair
useSlideContext()The current slide’s index and metadata
useSlideActive()Whether the calling slide is on screen β€” use this to gate animation. Also exported by @getnarro/shared-ui; both read the context Slide provides
useSlideIndex()The calling slide’s index
useFullscreen()Fullscreen state and toggle, outside a presentation
useViewportScale()The current scale factor
useWakeLock()Keep the screen awake while presenting

Fragment is also exported as Reveal, and new decks should use that name: import { Fragment } from "@getnarro/shared-ui" sits beside React.Fragment and <> in a file that is mostly JSX, nothing warns about the collision, and an author who writes <Fragment> meaning React’s gets a progressive reveal. Both names are the same component, so nothing has to change.

There is no usePresentation, useSlide, or useFragment hook β€” those names appeared in older documentation and were never exported.

IntroductionWhat is Narro, and should I be writing markdown or React?
InstallationWhat do I install, and what does the project look like afterwards?
First DeckWhat does a working React deck look like, end to end?
Markdown ModeHow do I split a slide, style one word, or reveal a line β€” without leaving the markdown file?
Writing AI PromptsWhat do I tell an AI so the deck it writes actually builds?
Rules for AI AgentsWhat do I paste into my repo so an agent stops writing decks that build wrong?
React APIWhich component or hook do I import, and what does it take?
CLIWhich command do I run, and what are its flags?
Markdown APIHow do I read, edit, or validate a deck file from my own code instead of by hand?
Component ReferenceWhat props does this component take, and which package do I import it from?
Verifying a deckHow do I know my deck is actually correct?
AnimationHow do I reveal a list one line at a time, or move between slides with something other than a cut?
NavigationHow does the audience move through the deck, and how do I present it?
Canvas & PositioningHow do I put something at an exact position instead of in the flow?
Images & MediaHow do I use an image as a background, tint it, or embed a video?
ArchitectureWhich package owns what, and why is the seam where it is?
Transform ModeHow do I zoom and pan across one big canvas instead of cutting between slides?
Import & ExportHow do I get this deck out as PPTX, PDF, or one file I can email?
AI IntegrationHow do I wire an AI assistant up to Narro so it can write and build decks?
ThemingHow do I change the colours, fonts, and overall look of a deck?
Deck TemplatesHow do I define one house style with named layouts my slides can reference, like a PowerPoint master?
TroubleshootingSomething is wrong with my deck. What is it, and how do I fix it?
LimitationsWhat can't Narro do, and what do I do instead?