• Stars
    star
    398
  • Rank 108,325 (Top 3 %)
  • Language
    Elm
  • License
    BSD 3-Clause "New...
  • Created almost 8 years ago
  • Updated 8 months ago

Reviews

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

Repository Details

Responsive and reliable web apps with Elm and Twitter Bootstrap

Elm Bootstrap [Travis build Status]

Elm Bootstrap is a comprehensive library package that aims to make it pleasant and reasonably type safe to use Twitter Bootstrap 4 CSS Framework in Elm applications.

Twitter Bootstrap is one of the most popular CSS (with some JS) frameworks for building responsive, mobile first web sites. Version 4 is fully embracing flexbox, which provides much better control and flexibility.

What's in it for me?

  • A reasonably type safe API for using Bootstrap
  • Some boilerplate is being handled for you
  • Interactive elements like Navbar, Dropdowns, Accordion, Modal, Popups, Dismissable Alerts, Tabs and Carousel
  • Horizontally AND vertically center stuff without tearing your hair out

Documentation

Getting started

  • Add rundis/elm-bootstrap to your elm-package.json
  • Start simple by using elm-reactor
module Main exposing (..)

import Bootstrap.CDN as CDN
import Bootstrap.Grid as Grid


view : Model -> Html Msg
view model =
    Grid.container []         -- Responsive fixed width container
        [ CDN.stylesheet      -- Inlined Bootstrap CSS for use with reactor
        , navbar model        -- Interactive and responsive menu
        , mainContent model
        ]


-- ... etc

Raison D'être

Twitter Bootstrap is something that I have been using in non-Elm projects extensively. I researched what was out there for Elm, but couldn't find anything that was quite as ambitious as I was looking for.

To a large extent, Twitter Bootstrap is just a bunch of CSS classes that can be applied to appropriate elements. Though Bootstrap can be used with just the vanilla Elm HTML library, it is very easy to get class strings wrong, apply the wrong classes to the wrong elements, or even nest elements in ways that will break the styling. This package aims to alleviate these issues by providing a higher degree of type safety.

This API tries to balance the wish for type safety with factors like

  • usability
  • need for flexibility / escape hatches
  • limitations in the type system (and/or just my lack of experience/knowledge about it)?

Twitter Bootstrap also consists of a few interactive elements. The interactivety is provided through the use of JavaScript. Elm Bootstrap can't have any of that obviously so the package will provide similar interactivity through the use of pure Elm.

To be completely honest, the main reason I created this was probably to learn Elm more deeply and to see what it would take to design a library and an API using it. You got to start somewhere right?

Alternatives

  • elm-bootstrapify - Supports Bootstrap 3, not as extensive but might suit your needs.
  • There are a few other Bootstrap related libraries, but they haven't been updated to Elm 0.18.
  • elm-mdl is of course the most obvious alternative, if you aren't fond of Bootstrap. It's very impressive and has been a great source of inspiration for elm-bootstrap.

Source of inspiration

Contributing / Collaborating

This package is still in its early stages and I would greatly appreciate feedback on usability, design, features, etc.

There's a bunch of work left to do, especially when it comes to documentation and examples. If anyone is interested in helping out, either by submitting pull requests or maybe even joining me in making this a top-notch and useful package, don't hesitate to get in touch. (@mrundberget on the Elm slack btw)

Stuff TODO

  • Ensure responsive behavior is fully supported
  • Encourage or automate screen reader support
  • Provide a nice API for all the utility classes
  • Proper test coverage
  • etc...

Release history

  • Going forward check out the GitHub releases

  • 5.0.0 Elm 0.19 Upgrade. Contains a few breaking changes. Please consult release notes on the releases tab on GitHub. No further maintenance is planned for an 0.18 compatible version.

  • 4.0.0 Updated to support Twitter Bootstrap 4.0 release version

    • Breaking changes - There's quite a few breaking changes. Please consult elm-package diff for details. For a large part the breaking changes are caused by major changes from Twitter Bootstrap Alpha 6 to Twitter Bootstrap 4 release. Since it was going to be breaking changes regardless, we took the liberty of refactoring some modules to improve the API as well.
    • New feature: Support breadcrumb
    • New feature: Added Border, Flex, Size, Spacing and Display modules (under Bootstrap.Utilities). They contain a bunch a functions for creating handy TWBS classes.
    • Addition: Added support for the new color roles in TWBS 4.0 accross a range of modules in elm-bootstrap
    • Addition: We now support dismissable alerts (with optional fade out animation).
    • Addition: You can now use dropdowns in inputgroups
    • Addition: Show accordion with one card open initially when that makes sense.
    • Addition: Allow tables to be responsive from given breakpoints.
    • Subtraction: Form validation got more tedious as TWBS changed this completely from the alpha release. Hopefully we can come up with improvements in this area to make it better again.
    • Special mention: TWBS changed how labels and checkboxes and radios need to be composed. You'll need to/really should provide an id (Checkbox.id or Radio.id)
  • 3.0.0

    • New Feature: Support for bootstrap carousels (great job by [@folkertdev])
    • Fix: Expose fieldset module
    • Breaking change: To better support deep linking, the tab module requires ids' for tab items. This will allow automatic url hash change when clicking tabs and you may specify active tab using customInitialState providing the tabitem id/hash. Checkout the Tabs module page in https://github.com/rundis/elm-bootstrap.info
    • Breaking change: Form selects exposes onChange rather than onInput. (api doc example fixed too)
    • Breaking change: Progress bar take float rather than int for progress value
    • Breaking change: Progress attr removed in favor of attrs function
    • Minor improvement: Possible to customize progress container with wrapperAttrs function
    • Minor improvement: Possible to customize dropdown menu with attributes
    • Minor improvement: Modal closes when you click on the backdrop (tx to [@farmio])
    • Fix: Apply custom attributes for inputgroup (tx to [@CallumJHays])
    • Api doc fixes: A long range of grammar/spelling fixes to api docs (tx to [@branjwong])
  • 2.0.0

    • New Feature: Support for radio buttons and checkbox buttons (tx to @folkertdev )
    • New Feature: Support for Input groups
    • New Feature: Experimental support for Popovers (and tooltips)
    • Improvment: Support for HTML.Keyed in Grid, Table and List groups
    • Minor improvement: Button onClick shorthand, input placeholder shorthand
    • Varios doc fixes and removal of unused CardBlock type. (Tx everyone that contributed !)
    • Made some progress on adding regression tests
  • 1.1.0 - Doc fixes and a grid col class bug

  • 1.0.0 - Initial release with most of TWBS core components covered

License

The BSD 3 Clause License

More Repositories

1

elm-light

Elm language plugin for Light Table
JavaScript
133
star
2

albums

Sample application for my blog series on creating a Single Page CRUD app using Elm and Haskell
Elm
123
star
3

clj-light-refactor

Light Table plugin providing refactoring support for clojure
JavaScript
55
star
4

acme-buddy

Sample applications for my blog series on authentication and authorization with buddy
Clojure
45
star
5

LightTable-Groovy

Groovy plugin for Light Table
JavaScript
25
star
6

parembrace

A different PareEdit for Light Table - powered by rewrite-cljs
JavaScript
14
star
7

lt-snippets

Snippets/templates support for Light Table
JavaScript
12
star
8

elm-bootstrap.info

User documentation for Elm Bootstrap
Elm
11
star
9

blog

My Personal Blog Space
CSS
10
star
10

elm-sweeper

Elm
9
star
11

elm-workshop

Get started building Web Apps with Elm
Elm
9
star
12

gradle-buster-plugin

Gradle plugin for running buster js javascript tests
Groovy
7
star
13

LightTable-settings

My Personal settings for the LightTable Editor
JavaScript
6
star
14

generic-gradle-model

A generic General purpose Gradle model that exposes more of your project info than what you get from the shipped tooling api.
Groovy
4
star
15

elm-autoselect

Customizable autocomplete / select with debouncing support etc
Elm
3
star
16

ltplanck

Light Table Planck plugin
JavaScript
3
star
17

AsciiLight

AsciiDoc preview plugin for Light Table
JavaScript
2
star
18

TapestryGorm

Tapestry and Gorm in harmony
Groovy
2
star
19

osloelmday

Elm
1
star
20

elm-jz2016

Elm
1
star
21

euro-2016-predictions

Coming soon
Elm
1
star
22

Dumpling

Gradle sample multiproject
Java
1
star
23

elm-docker-cloud-demo

Sample App for a potential elm-docker-cloud api lib
Elm
1
star
24

elm-flatmap2016

Functional Programming for The Web using Elm - Flatmap 2016
JavaScript
1
star
25

lt-user-plugin

My User Plugin for Light Table - The new home of all my settings and tweaks
JavaScript
1
star
26

ts-ws-machine

TypeScript WebSocket Client modelled as an FSM. Comes with reconnect and heartbeat support
TypeScript
1
star