Home

Awesome

Elm UI Explorer

logo

Build Status

UI Component Explorers and Style Guides have been around for a while now. We don't build pages anymore but components that are assembled together to build systems.

In the Elm world, components are just called views, and are defined as pure functions. Elm UI Explorer takes advantage of the composability and the purity of Elm and offers a way to showcase your views and their states in a single tool. This project is inspired by React Storybook and styled with Tailwind

How to use it ?

Quick Start

First install the cli.

npm install @kalutheo/uie

Then initialize your project.

uie init

To run your explorer:

npm run uie

Finally, you should be able to see your explorer by visiting http://localhost:8000

Manual Setup

Here is a basic example of a button showcased in Elm UI Explorer:

Add this to your Main.elm file.

import Html
import Html.Attributes exposing (style)
import UIExplorer exposing (UIExplorerProgram, defaultConfig, explore, storiesOf)


button : String -> String -> Html.Html msg
button label bgColor =
    Html.button
        [ style "background-color" bgColor ]
        [ Html.text label ]


main : UIExplorerProgram {} () {}
main =
    explore
        defaultConfig
        [ storiesOf
            "Button"
            [ ( "SignIn", \_ -> button "Sign In" "pink", {} )
            , ( "SignOut", \_ -> button "Sign Out" "cyan", {} )
            , ( "Loading", \_ -> button "Loading please wait..." "white", {} )
            ]
        ]

Then in your Html add a link to the Elm UI Explorer stylesheet

<link
  rel="stylesheet"
  type="text/css"
  href="https://cdn.jsdelivr.net/gh/kalutheo/elm-ui-explorer@master/assets/styles.css"
/>

You can now run the Main.elm application with the tool of your choice.

Examples

Checkout all examples source code here

Main Features

Best Practices

FAQ

For further informations, you can check the Frequently Asked Questions (FAQ) section.