# Code walkthrough

Emphasize and scroll to selected lines of source.

Source: https://legend.so/slides/effects/code-walkthrough/

Legend Slides: Preview.

[All effects](https://legend.so/slides/effects/)

[Code walkthrough preview](https://legend.so/slides/effects/previews/code-walkthrough/c6b84084f07cae9b191ff4de977d7127906921754079742f925708b2f775d50e.mp4)

Recorded in Legend Slides for macOS (release build).

[Install in Slides](legend-slides://effects/install?pack=presenting&version=1.0.5) [Open example](legend-slides://effects/example?effect=code-walkthrough) [Download example](https://legend.so/slides/effects/examples/code-walkthrough/22cb185643d6b6fbe9153fdf0ff130775c34c3254fa9c1f0b407c58794ba5730.mdx)

Requires a Legend Slides build with effect installation support. Installs the presenting pack (1.0.5, 22 KB source) and its dependencies. macOS host capabilities: reanimated, skia. Installed decks work offline.

## Use it in a deck

code-walkthrough.mdx

```mdx
---
title: Code walkthrough
---

import { View, Text } from "react-native";
import { CodeWalkthrough } from "slides:presenting/CodeWalkthrough";

export const code = `async function showResults(query) {
  const rows = await search(query);
  const visible = rows.slice(0, 20);
  setResults(visible);
  announce(visible.length);
}`;
export const highlights = [2, 3, 4];
export const notes = ["Fetch matching rows", "Keep the visible rows", "Publish the results"];

# Code walkthrough

<View style={{ width: 1696, height: 650 }}>
<Steps count={3}>{step => <CodeWalkthrough source={code} lines={[highlights[step], highlights[step]]} fontSize={34} explanation={<Text style={{ color: "white", fontSize: 52 }}>{notes[step]}</Text>} />}</Steps>
</View>
```

## Configure

**source**

Source text to display.

**lines**

One-based selected lines.

**explanation**

Content beside the code.

**fontSize**

Set code text size; defaults to 25.

Only imported effects enter the compiled deck. [Installation and versioning →](https://legend.so/slides/effects/installation/)

[View Markdown](https://legend.so/slides/effects/code-walkthrough.md)[Report a documentation correction](https://github.com/LegendApp/legend-docs/issues/new?title=Docs%3A+Code+walkthrough&body=Page%3A+https%3A%2F%2Flegend.so%2Fslides%2Feffects%2Fcode-walkthrough%0A%0AWhat+is+incorrect+or+missing%3F%0A%0AExpected+behavior+or+supporting+source%3A%0A)
