rundis/elm-bootstrap/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Bootstrap.Card

A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options.

Cards

view : Config msg -> Html msg

View a card standalone. To create a card you start off with a basic configuration which you can compose of several optional elements.

Card.config [ Card.outlineInfo ]
    |> Card.headerH1 [] [ text "My Card Info" ]
    |> Card.footer [] [ text "Some footer" ]
    |> Card.block []
        [ Card.titleH1 [] [ text "Block title" ]
        , Card.text [] [ text "Some block content" ]
        , Card.link [ href "#" ] [ text "MyLink"]
        ]
    |> Card.view
  • config - See Config for what items you may compose your cards with
type Config msg

Opaque type representing the view configuration of a card

You may use the following functions to expand/change a configuration:

headerH1 : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a card h1 header

  • attributes List of attributes
  • children List of child elements
  • config A card Config that you wish to extend/override
headerH2 : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a card h2 header

  • attributes List of attributes
  • children List of child elements
  • config A card Config that you wish to extend/override
headerH3 : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a card h3 header

  • attributes List of attributes
  • children List of child elements
  • config A card Config that you wish to extend/override
headerH4 : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a card h4 header

  • attributes List of attributes
  • children List of child elements
  • config A card Config that you wish to extend/override
headerH5 : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a card h5 header

  • attributes List of attributes
  • children List of child elements
  • config A card Config that you wish to extend/override
headerH6 : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a card h6 header

  • attributes List of attributes
  • children List of child elements
  • config A card Config that you wish to extend/override
type CardHeader msg

Opaque type representing a card header element

type CardFooter msg

Opaque type representing a card footer element

Images

imgTop : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a element to be shown at the top of a card

  • attributes List of attributes
  • children List of child elements
imgBottom : List (Attribute msg) -> List (Html msg) -> Config msg -> Config msg

Create a element to be shown at the bottom of a card

  • attributes List of attributes
  • children List of child elements
type CardImageTop msg

Opaque type representing a card image placed at the top

Opaque type representing a card image placed at the bottom

Options

You can customize the look and feel of your cards using the following options

config : List (CardOption msg) -> Config msg

Template/default config which you use as a starting point to compose your cards.

  • options - List of card wide styling options
align : HAlign -> CardOption msg

Option to specify horizonal alignment of card contents

primary : CardOption msg

Give cards a primary background color and appropriate foreground color

success : CardOption msg

Give cards a success background color and appropriate foreground color

info : CardOption msg

Give cards a info background color and appropriate foreground color

warning : CardOption msg

Give cards a warning background color and appropriate foreground color

danger : CardOption msg

Give cards a danger background color and appropriate foreground color

outlinePrimary : CardOption msg

Give cards a primary colored outline

outlineSuccess : CardOption msg

Give cards a success colored outline

outlineInfo : CardOption msg

Give cards a info colored outline

outlineWarning : CardOption msg

Give cards a warning colored outline

outlineDanger : CardOption msg

Give cards a danger colored outline

inverted : Color -> CardOption msg

Give cards a custom dark background color with light text

attrs : List (Attribute msg) -> CardOption msg

When you need to customize a card item with standard Html.Attribute attributes use this function

type alias CardOption msg =
CardOption msg

Opaque type representing options for customizing the styling of a card

Blocks

List (BlockOption msg)
-> List (BlockItem msg)
-> Config msg
-> Config msg

The building block of a card is the card block. Use it whenever you need a padded section within a card. You may have multiple blocks in a card, this function will add blocks to your Cards.

  • blockOptions - List of block options to configure block level styling
  • item - List of block items
  • config A card Config that you wish to add a block element to
listGroup : List (Item msg) -> Config msg -> Config msg

You may add list groups, just like you can add card blocks to a Card. Use the li function in the ListGroup module to add and configure the list items.

type CardBlock msg

Opaque type representing a card block element

type alias BlockItem msg =
BlockItem msg

Opaque type representing a legal card block child element

Block title

titleH1 : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block h1 title

  • attributes List of attributes
  • children List of child elements
titleH2 : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block h2 title

  • attributes List of attributes
  • children List of child elements
titleH3 : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block h3 title

  • attributes List of attributes
  • children List of child elements
titleH4 : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block h4 title

  • attributes List of attributes
  • children List of child elements
titleH5 : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block h5 title

  • attributes List of attributes
  • children List of child elements
titleH6 : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block h6 title

  • attributes List of attributes
  • children List of child elements

Misc

text : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a card text element

  • attributes List of attributes
  • children List of child elements
blockQuote : List (Attribute msg) -> List (Html msg) -> BlockItem msg

Create a block quote element

  • attributes List of attributes
  • children List of child elements
custom : Html msg -> BlockItem msg

Add a custom HTML element to be displayed in a Card block

Block options

blockAlign : HAlign -> BlockOption msg

Option to specify horizontal alignment of a card block item

Card.blockAlign Text.xs
blockAttrs : List (Attribute msg) -> BlockOption msg

When you need to customize a block item with standard Html.Attribute attributes use this function

type alias BlockOption msg =
BlockOption msg

Opaque type representing options for styling a card block

Composing cards

Cards can be composed into

group : List (Config msg) -> Html msg

Use card groups to render cards as a single, attached element with equal width and height columns. Card groups use display: flex; to achieve their uniform sizing.

deck : List (Config msg) -> Html msg

Need a set of equal width and height cards that aren’t attached to one another? Use card decks

columns : List (Config msg) -> Html msg

Cards can be organized into Masonry-like columns with just CSS by wrapping them in .card-columns. Cards are built with CSS column properties instead of flexbox for easier alignment. Cards are ordered from top to bottom and left to right.