• Stars
    star
    395
  • Rank 109,040 (Top 3 %)
  • Language
    Elm
  • License
    BSD 3-Clause "New...
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use HTML in Elm!

HTML

Quickly render HTML in Elm.

Examples

The HTML part of an Elm program looks something like this:

import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)

type Msg = Increment | Decrement

view : Int -> Html Msg
view count =
  div []
    [ button [ onClick Decrement ] [ text "-" ]
    , div [] [ text (String.fromInt count) ]
    , button [ onClick Increment ] [ text "+" ]
    ]

If you call view 42 you get something like this:

<div>
  <button>-</button>
  <div>42</div>
  <button>+</button>
</div>

This snippet comes from a complete example. You can play with it online here and read how it works here.

You can play with a bunch of other examples here.

Learn More

Definitely read through guide.elm-lang.org to understand how this all works! The section on The Elm Architecture is particularly helpful.

Implementation

This library is backed by elm/virtual-dom which handles the dirty details of rendering DOM nodes quickly. You can read some blog posts about it here:

More Repositories

1

compiler

Compiler for Elm, a functional language for reliable webapps.
Haskell
7,493
star
2

core

Elm's core libraries
Elm
2,791
star
3

elm-lang.org

Server and client code for the Elm website.
Elm
1,987
star
4

projects

Curated collection of projects for folks looking to collaborate within the Elm ecosystem.
423
star
5

browser

Create Elm programs that run in browsers!
Elm
311
star
6

package.elm-lang.org

website for browsing packages and exploring documentation
Haskell
293
star
7

parser

A parsing library, focused on simplicity and great error messages
Elm
226
star
8

virtual-dom

The foundation of HTML and SVG in Elm.
JavaScript
208
star
9

error-message-catalog

A catalog of broken Elm programs / data to improve error messages
Elm
173
star
10

http

Make HTTP requests in Elm
Elm
155
star
11

svg

Fast SVG in Elm
Elm
146
star
12

file

Select files. Download files. Work with file content.
Elm
106
star
13

time

A simplified approach to working with dates, times, and time zones.
Elm
92
star
14

json

Work with JSON in Elm
Elm
90
star
15

bytes

Work with bytes and implement network protocols
Elm
80
star
16

url

Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
Elm
75
star
17

expectations

Trying to set expectations about @elm processes
53
star
18

editor-plugins

List of editor plugins for Elm.
50
star
19

random

Generate random values in Elm
Elm
45
star
20

regex

If you really need regex in Elm, it is possible.
Elm
33
star
21

color

Standard representation of colors, encouraging sharing between packages.
Elm
24
star
22

foundation.elm-lang.org

Source code for the ESF website
Elm
17
star
23

project-metadata-utils

Work with elm.json and docs.json files in Elm
Elm
16
star
24

forum-rules

Rules for Elm forums
9
star