FordLabs/elm-star-rating/1.0.1

NOTE: the latest version is 2.0.1

Rating

A simple five star rating component. Uses unicode star characters (U+2605 & U+2606).

Init

Initial rating state. Sets rating to zero.

View

classView : List String -> State -> Html Msg

Render the component. Accepts a list of css class names and a Rating.State. Note that the component uses text characters to display the stars, so use css accordingly.

Rating.classView [ "cssClass1", "cssClass2" ] ratingState
styleView : List ( String, String ) -> State -> Html Msg

Render the component. Accepts a list of style tuples and a Rating.State. Note that the component uses text characters to display the stars, so use css accordingly.

Rating.styleView [ ( "color", "red" ) ] ratingState

Update

Update the state of the rating component.

RatingMsg msg ->
    ( { model | ratingState = (Rating.update msg model.ratingState) }, Cmd.none )

Helpers

get : State -> Int

Get the current rating

Rating.get ratingState

Types

type State

Opaque type obscuring rating model

type Msg

Opaque type obscuring rating messages