Expo Svelte
GitHub

Before we begin

What is Expo Svelte?

Expo Svelte lets you write Android and iOS apps as Svelte 5 components. Your components don't run in a web view: they become real native views, laid out and drawn by the platform.

src/routes/+mobile.svelte
<script lang="ts">
	import { Pressable, Screen, Text, View } from 'expo-svelte';

	let taps = $state(0);
</script>

<Screen title="Hello">
	<View style={{ flex: 1, padding: 24, gap: 16, justifyContent: 'center' }}>
		<Text>Tapped {taps} times.</Text>
		<Pressable onPress={() => taps++} accessibilityRole="button">
			<Text>Tap</Text>
		</Pressable>
	</View>
</Screen>

If you know Svelte, most of this is familiar: runes, snippets, {#each}, {#await}, stores and context all work. What changes are the building blocks. You use View, Text and Pressable instead of div, p and button, and style objects instead of CSS. Coming from the web lists the differences.

Under the hood, Expo Svelte runs on React Native's renderer, without React. Your components are compiled by Svelte, run in Hermes (React Native's JavaScript engine) and drive the native views directly.

Expo Svelte and SvelteKit

An Expo Svelte app is a SvelteKit project. You create it with npx sv create, and the web app stays where it was:

  • src/routes/+page.svelte is a page of the web app.
  • src/routes/+mobile.svelte is a screen of the native app, in the same directory.
  • src/lib is shared. A module that doesn't touch the DOM can be imported by both.

The native app uses SvelteKit's ideas where they fit: routing is filesystem-based, layouts wrap screens, and remote functions call your SvelteKit server from the phone.

Expo Svelte and Expo

Expo is the toolchain underneath. It generates the Android and iOS projects, links native modules, and builds and installs your app. You don't need to know Expo to start, and Development builds explains the parts you will meet.

Because the library has native code of its own, your app is a build of your own, not something you open in the Expo Go app.

What works today

Expo Svelte targets Expo SDK 57 and React Native 0.86, on Android and iOS phones. The same project still builds for the web through SvelteKit.

Not there yet:

  • No Fast Refresh. Saving a file reloads the app's root, and component state is lost.
  • Phones only: tablet and foldable layouts, and tvOS, are not supported yet.
  • Screen reader support is checked by automated tests, not yet by people using TalkBack and VoiceOver.
  • Svelte transitions play on HTML elements only, and a few CSS properties, such as filter, don't animate: see Svelte transitions.
  • No DOM libraries, no React components, and no Expo dev client.
  • Building on Expo's servers (EAS Build) is untested.
  • Expo Svelte needs a build of Svelte from an open pull request, and SvelteKit 3.1.1 exactly. init installs both.

Next steps

Creating a project takes you from npx sv create to your app running on a phone.

Type to search the guide.