A floating action button represents the primary action in an application.
A floating action button only contains an icon to indicate its action. For a floating action button that may contain text, refer to the extended floating action button.
Developers are required to manually position the floating action button within their page layout, for instance by setting a fixed position via CSS.
import Html.Attributes exposing (style)
import Material.Fab as Fab
type Msg
= FabClicked
main =
Fab.fab
(Fab.config
|> Fab.setOnClick FabClicked
|> Fab.setAttributes
[ style "position" "fixed"
, style "bottom" "2rem"
, style "right" "2rem"
]
)
"favorite"Specify a message when the user clicks the floating action button
Specify whether the floating actions button should be smaller than normally
Specify whether a floating action button should transition off the screen
Specify additional attributes
If you want the floating action button to appear in smaller size, set its
setMini configuration option to True.
Fab.fab (Fab.config |> Fab.setMini True) "favorite"If you want the floating action button to transition off the screen, set its
setExited configuration option to True.
Fab.fab (Fab.config |> Fab.setExited True) "favorite"
Floating action button configuration