Scritto Icon

scritto_lustre

Package Version Hex Docs

A gleamy lustre wrapper over the scritto JS library.

SwiftUI’s numeric text transition, on the web.

Installation

gleam add scritto_lustre@1

npm install @scritto/core

Usage

Register in main

let assert Ok(_) = scritto.register()

Use in views

Text

import scritto_lustre as scritto

fn scritto_view(name: String) -> Element(Msg) {
  scritto.text("Hello " <> name, with: [
    scritto.animate(True),
    scritto.edge_fade(scritto.Never),
  ])
}

Flow

import scritto_lustre as scritto

fn scritto_view(n: Int) -> Element(Msg) {
  scritto.flow([
    html.text("The number of downloads is "),
    scritto.text(int.to_string(n), with: []),
    html.text("downloads"),
  ])
}

For more details visit https://github.com/JaceThings/Scritto/wiki/API
Further documentation can be found at https://hexdocs.pm/scritto_lustre.

Development

gleam run   # Run the project
gleam test  # Run the tests
✨ Search Document