A lightweight but featureful virtual DOM library, primarily for web use.
no_std
and no dependencies without the "callbacks"
feature.
Please use cargo-edit to always add the latest version of this library:
cmd
cargo add lignin && cargo add -D lignin --features callbacks
Some type constraints are more strict with the "callbacks"
feature enabled, so make sure to always check this way!
When writing a renderer that supports callbacks, instead use
cmd
cargo add lignin --features callbacks
to always enable the feature.
"callbacks"
Enables DOM callback support. Off by default. Requires std
.
Apps or components can be written against the callback API without enabling this feature, in which case those code paths can be erased at compile-time.
```rust use lignin::{Node, Element, ElementCreationOptions};
// Please bring your own allocator where necessary.
let _ = &Node::HtmlElement {
element: &Element {
name: "DIV", // Use all-caps for more efficient DOM interactions.¹
creationoptions: ElementCreationOptions::new(), // const fn
builder and getter/setter patterns for extensible interfaces.
attributes: &[],
content: Node::Multi(&[
"Hello! ".into(), // Some convenience included.
Node::Comment {
comment: "--> Be mindful of HTML pitfalls.