danielnarey/elm-modular-ui/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Ui.Source

UI Content: External Source

This module contains helpers to embed external content into your page layout, with built-in features for web accessibility. The embedding elements are assigned the .source class to allow for custom styling.

{ path : String
, mediaType : String
, altText : String
}
-> Element msg

Construct an object element to display content from an external source. The first argument gives the URL or relative file path, the second argument specifies the media type, and the third argument provides a content label for screen readers. A link to open the source in a new window is generated as a fallback if the content fails to load.

{ path = "files/myfile.pdf"
, mediaType = "application/pdf"
, altText = "Load report from PDF file"
)
  |> Ui.Source.object
  |> Ui.render


--> <object class="source" data="files/myfile.pdf" type="application/pdf" role="document" aria-label="Load report from PDF file">
--    <p>Click to load in a new window:
--      <a href="files/myfile.pdf" target="_blank">files/myfile.pdf</a>
--    </p>
--  </object>
  • HTML tag: <object>
  • ARIA role: document
  • Element class: .source
  • Available modifiers: none
  • Bulma CSS reference: none (.source is not a Bulma element class)
{ path : String
, altText : String
}
-> Element msg

Construct an iframe element to display content from an HTML source. The string argument gives the URL or relative file path to the source.

{ path = "http://elm-lang.org"
, altText = "The Elm language home page"
)
  |> Ui.Source.iframe
  |> Ui.Render


--> <iframe class="source" src="http://elm-lang.org" role="document" aria-label="The Elm language home page"></iframe>
  • HTML tag: <iframe>
  • ARIA role: document
  • Element class: .source
  • Available modifiers: none
  • Bulma CSS reference: none (.source is not a Bulma element class)
embed : ( String, String, String ) -> Element msg

Construct an object element to display content from an external source. The first argument gives the URL or relative file path and the second argument specifies the media type (see https://www.iana.org/assignments/media-types/media-types.xhtml for a list of media type codes).

( "flash/animation.swf"
, "application/x-shockwave-flash"
, "Play an interactive Flash animation"
)
  |> Ui.Source.embed
  |> Ui.render


--> <embed class="source" src="flash/animation.swf" type="application/x-shockwave-flash" role="application" aria-label="Play an interactive Flash animation">
  • HTML tag: <embed>
  • ARIA role: application
  • Element class: .source
  • Available modifiers: none
  • Bulma CSS reference: none (.source is not a Bulma element class)