Skip to content
Branch: master
Clone or download
Latest commit 7f45693 Jun 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets feat(config): add custom header May 12, 2019
docs fix(examples): regenerated new examples Jun 20, 2019
examples
src doc(readme): fix small spacing and indent issues Jun 20, 2019
.gitignore feat(menu): add menu visibility plugin Apr 30, 2019
.travis.yml ci(travis): remove yes params May 7, 2019
CHANGELOG.MD Create CHANGELOG.MD May 18, 2019
LICENSE Add a MIT license Sep 28, 2017
documentation.json fix(dsm): fix image issue on example May 18, 2019
elm.json
explorer-logo-small.png doc(readme): fix small spacing and indent issues Jun 20, 2019
explorer-logo.png feat(tailwind) : Add Logo and polish last details Mar 3, 2018
readme.md doc(example): fix example syntax Jun 20, 2019
tailwind.js feat(prefix): add prefix to tailwindcss Nov 29, 2017

readme.md

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 ?

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.

Checkout more examples here

Main Features

  • Deep linking : You can easily share UI Explorer states by copying and pasting the url ( ex: attach them to your JIRA tickets, Pull Request etc... )

  • Categories : Your UI Explorer can be divided into categories. Convenient if you have many views and you want to group them by family.

  • Plugins : Elm UI Explorer has a mechanism that let you extend the tool by creating your own plugins. By defaults the library comes with built in plugins.

  • Customization : You can make the header match your brand identity by changing colors, title and icons.

Best Practices

  • For hot reloading, it's recommended to use Create Elm App. Elm Live is also a great alternative that provides live reloading.

  • In order to avoid CSS conflicts with built in UI Explorer Styles, consider using elm-css or elm-ui. Theses tools use technics that prevent styles collisions by scoping the css.

  • Try to adopt SDD (StoryBook Driven Development), creating UI this way can be very efficient.

  • Use Atomic Design paradigm. This will help you build a scalable Design System.

  • All ids (Story names and categories) should be unique (ex: DropDown Menu, Loading, Loaded etc... )

You can’t perform that action at this time.