aboutsummaryrefslogtreecommitdiff
path: root/examples/01-hello-world/src/app.gleam
blob: 37ea96cc0db794adb23483edf92f01bab6eee309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import lustre
import lustre/attribute
import lustre/element
import lustre/element/html
// These examples are written with `lustre/ui` in mind. They'll work regardless,
// but to see what `lustre/ui` can do make sure to run each of these examples with
// the `--use-lustre-ui` flag:
//
//   $ gleam run -m lustre dev --use-lustre-ui
//
// In your own apps, make sure to add the `lustre/ui` dependency and include the
// stylesheet somewhere.
import lustre/ui

pub fn main() {
  let styles = [#("width", "100vw"), #("height", "100vh"), #("padding", "1rem")]

  lustre.element(ui.centre(
    [attribute.style(styles)],
    html.div([], [
      html.h1([], [element.text("Hello, world.")]),
      html.h2([], [element.text("Welcome to Lustre.")]),
    ]),
  ))
}