Chips are compact elements that allow users to enter information, select a choice, filter content, or trigger an action.
Input chips are a variant of chips which enable user input by converting text into chips.
import Material.Chip.Input as InputChip
import Material.ChipSet.Input as InputChipSet
type Msg
= ChipSelected String
main =
InputChipSet.chipSet []
[ InputChip.chip InputChip.config "Chip One"
, InputChip.chip InputChip.config "Chip Two"
]Default configuration of an input chip
Specify a message when the user clicks on a chip
Specify a message when the user clicks on a chip's trailing icon
Specify whether an input chip displays a leading icon
Specify whether an input chip displays a trailing icon
Specify additonal attributes
Input chip view function
Input chip type
This library natively supports Material Icons. However, you may also include SVG or custom icons such as FontAwesome.
Icon type
Material Icon
ActionChip.chip
(ActionChip.config
|> ActionChip.setIcon (ActionChip.icon "favorite")
)
"Add to favorites"Custom icon
ActionChip.chip
(ActionChip.config
|> ActionChip.setIcon
(ActionChip.customIcon Html.i
[ class "fab fa-font-awesome" ]
[]
)
)
"Font awesome"SVG icon
ActionChip.chip
(ActionChip.config
|> ActionChip.setIcon
(ActionChip.svgIcon
[ Svg.Attributes.viewBox "…" ]
[-- …
]
)
)
"Font awesome"
Configuration of an input chip