SvelTTY provides a runtime that allows you to render and interact with Svelte apps in the terminal.
Pains are taken to make it easy to use and translate mindset-wise from the web to a TUI. There are no special <Box> or <Text> components; just use regular HTML, CSS and JavaScript, including Svelte runes.
<img> elements in supported terminals. Colors, alignment/layout, padding/margin, backgrounds, borders, states, gradients et cetera, including calc() and custom CSS variables, work out of the box as you would (mostly) expect.$state, $effect, $derived, etc.).npm install sveltty svelte
Svelte is a peer dependency, so you need to install it as well.
import { runFile } from 'sveltty';
await runFile('./App.svelte', {
baseDir: import.meta.dirname,
});
or with runner:
node --import sveltty/register app.js
import App from './App.svelte';
import { runComponent } from 'sveltty';
runComponent(App);
See the example for a complete example.
display values that are supported are flex and none, with flex being the default.ch as the CSS sizing unit, but any non-percentage unit is treated the same, so feel free to use px etc.<img> elements to render images in supported terminals. Be sure to set a width and height.MIT