# Introduction

Lithe is a web UI library for Kotlin. A component is a single `.lithe` file where you write Kotlin, HTML and scoped CSS side by side, like a Svelte
component. It compiles to plain Kotlin on a small reactive runtime. The page is rendered to HTML at build time, then Kotlin/JS hydrates it in the browser.

```html
<script kotlin>
	prop val step: Int = 1

	var count by state(0)
	val doubled by derived { count * 2 }
</script>

<button class="counter" @click={count += step}>{count} × 2 = {doubled}</button>

@if (count > 10) {
	<p>That's a lot of clicks. Everything okay at home?</p>
}

<style>
	.counter { padding: .5rem 1rem; }
</style>
```

And here it is, running live in the page:


> Heads up, Lithe is **experimental**. **0.1.0** is on Maven Central, for a Gradle project like a [Kobweb](/docs/sites/kobweb) site, and you can also write an app
> as a module of the [Lithe repository](https://github.com/Ayfri/lithe).

## What it does

| Feature | Read more |
|---------|-----------|
| **HTML first.** Every page is complete before any JavaScript runs, and only the components that can change hydrate, as islands. | [Static pages and islands](/docs/sites/islands) |
| **Fine-grained updates.** A component runs once, and each dynamic part of the page follows the state it reads. No virtual DOM. | [State](/docs/components/state) |
| **Plain Kotlin.** Props, state and handlers are Kotlin, with the typed DOM of `kotlin-browser`. A client only carries what its components use. | [Component files](/docs/components/files) |
| **A template language.** Blocks such as `@if`, `@for` and `@await`, two-way bindings, `<head>` elements and scoped styles. | [Control flow](/docs/components/control-flow), [Bindings](/docs/components/bindings), [Styles](/docs/components/styles) |
| **Routing.** `var path by window.route()` follows the URL, and links move without reloading through the Navigation API where the browser has it. | [Routing](/docs/sites/routing) |
| **Compose interop.** Components and Compose HTML composables mount each other, and only the sites that use Compose ship it. | [Compose](/docs/sites/compose), [Kobweb](/docs/sites/kobweb) |
| **Tooling.** A dev server that rebuilds on save, and a language server with a VS Code extension and a plugin for IntelliJ IDEA. | [Dev server](/docs/sites/dev-server), [Editors](/docs/tooling/editors) |

## Where to go next

| Page | What it covers |
|------|----------------|
| [Getting started](/docs/getting-started) | Run an example, then build an app of your own. |
| [How it works](/docs/how-it-works) | From a `.lithe` file to HTML and JavaScript, and why it is built this way. |
| [Component files](/docs/components/files) | The script, props and the parts of a file. |
| [Static sites](/docs/sites/static-sites) | Building a site and what the build writes. |
| [Compile errors and warnings](/docs/reference/errors) | Every message of the compiler, with its cause. |
| [Build, dev server and runtime errors](/docs/reference/build-errors) | The messages of a site build, the dev server and a running app. |
| [Optimizations](/docs/reference/optimizations) | The choices that keep the client small and fast, with their measured effect and what they ask of you. |
| [Performance](/docs/reference/performance) | Sizes and times, against Svelte and Compose. |
