lithium
(lith·i·um) noun

The lightest metal and least dense of all solid elements.
It's also the name of a very light frontend library, with the modern web in mind, and only 7kb.

How to use it? All you need to know in 1 minute:
The modern web in a few KBs.

Lithium uses standard Web API's and sticks mostly to HTML, instead of inventing a new language on top of it.

Just follow a few basic rules of markup:

- All props down, all changes up via events
- Values in templates are always read-only
- `<template for="x of y"></template>` to repeat
- `<template if="xyz"></template>` to add/remove
- `<div bind-xyz="expression">` to bind a property to a reactive expression
- `<button on-xyz="handler()">` to listen to an event xyz (`element.onxyz` = ... also works)
- Use `<script setup="">` to define a component/app behavior
- Use `ref()` and `computed()` to create reactive values

By using [inline components and a declarative API](/docs), an entire app could fit into one file.

Here's a quick example:
Template syntax Add life to your static HTML text Declarative Component API
          import { defineProp } from '@li3/web';

          export default function setup() {
            const string = defineProp('string');
            const number = defineProp('number', { default: 123 });
            const object = defineProp('other', { default: () => ({ hello: 'world' }) });
          }
      
        import { defineEvent } from '@li3/web';

        export default function setup() {
          const onUpdate = defineEvent('update');
          onUpdate(123);
        }
      
          import { ref, unref, computed, watch } from '@li3/web';

          export default function setup() {
            const name = ref('Joe');
            const greeting = computed(() => 'Hello, ' + unref(name));

            function isEmpty() {
              return !!unref(name);
            }

            watch(() => unref(name), (value) => { /**/ });

            return { name, greeting, isEmpty }
          }
        
          import { onInit, onUpdate, onDestroy } from '@li3/web';

          export default function setup() {
            onInit(function() {
              // called once on mount
            });

            onUpdate(function() {
              // called every time a prop changes
            });

            onDestroy(function() {
              // called once on unmount
            });
          }
        
Conditionals and loops Repeat a template or add/remove elements based on a condition

Need more? Head to the full documentation to see the API and more examples!