Savory is library for building user interface.
Features
- Views: Views can be any type implement
View
trait or any standalone function that returnsNode
, views can be trait object which make them very composable. - Elements: Savory uses elements as core building unit when building stateful UI. Elements owns thier state and handle user inputs via messages.
- Collection of UI elements: Savory ships with collection of resuable and themeable UI elements.
- Theme: UI elements can be themed by any type that implement
ThemeImpl
trait, themes have full control on the element appearance. - Typed HTML: Use typed CSS and HTML attributes, Savory try hard not to rely on strings when creating CSS and HTML attributes since these can produce hard to debug bugs.
- Enhance Seed API: Enhancement on Seed API that makes working with
Node
,Orders
fun.
Savory tries to make writing UI elements fun and boilerplate free.
Savory crates:
savory
: savory CLIsavory-core
: Library for building user interface (this crate)savory-html
: Typed HTML for Savorysavory-elements
: UI Elements based on Savorysavory-derive
: Helper derives
Core Concept
Savory have two main types View and Element, View types produce static HTML, while Element types produce interactive HTML, as simple as that.
Elements types must implemente Element
and View
traits, which would
make them interactive.
View types must implemente View
trait, that would produce the static
HTML.
Counter Example
Here is very simple counter, that doesn't use all Savory features, but it's good as starting point for newcomers.
use *;
use *;
use *;
// app element (the model)
;
// app message