UI.Icon is an implementation of icons using an SVG-spritesheet.
Icons' names are after their proposed action/symbolism instead of describing its shape. Consequently, we don't use the same icon for different operations as these would confuse the end-users.
To use these icons, first, you must insert the spritesheet once (and only once) in the layout.
The sprite sheet injection uses a custom Html component that later populates using a parcel's import.
See Icon.svgSpriteImport to know what to do on the Elm's side.
Parcel's instructions are in README.
An icon can be created and rendered as in the following pipeline:
Icon.logout "Logout from this account"
|> Icon.renderElement renderConfigThe Icon type is used for describing the component for later rendering.
A plus sign. E.g., used to indicate the creation of new items in tables/lists.
Icon.add "Create new user"A check mark, commonly used inside checkboxes and radio buttons.
Icon.check "Done"A times sign. Usually used for closing dialogs.
Icon.close "Close this notification"A gear. Usually used for opening settings managers.
Icon.configure "Open display settings"A group of squares acting as files with an arrow pointing to the bottom
Icon.download "Download CSV"A chat-like baloon. In Paack's apps this symbolizes the log of actions.
Icon.eventLog "Events"A funnel symbol represented by 3 lines horizontally aligned.
Icon.filter "Filter title column"Two vertical parallel arrows pointing to opposite directions.
Icon.move "Move item"An arrow pointing to the right used in chevrons and paginators.
Icon.nextContent "Next page"A bell for indicating notifications.
Icon.notifications "See notifications"Internal jargon in Paack.
Icon.paackSpaces "Spaces"An arrow pointing to the left used in chevrons and paginators.
Icon.previousContent "Previous page"An A4 ink printer. Indicates the availability to print something related to the surrounding content.
Icon.print "Print pacakage's barcode"A circe with a line on center similar to a "No Way" road sign.
Icon.remove "Remove item"Tree-bar stacked vertically. It's usually used in mobile to toggle left bar menus.
Icon.sandwichMenu "Open pages menu"A magnifying glass. For use in search-related queries.
Icon.search "Search package with barcode"The space icon with a search icon in the right-bottom.
Icon.searchSpace "Search Space"Ellipsis (three-dots horizontally aligned). For showing hidden details.
Icon.seeMore "Read more about this article"An arrow pointing up.
Icon.sortDecreasing "Sort from Z to A"An arrow pointing down.
Icon.sortIncreasing "Sort from A to Z"A foldable paper, toggle some content between showing/hiding, or full/collapsed.
Icon.toggle "Expand technical details"An arrow pointing down. May indicate the expansion of a hidden content below.
Icon.toggleDown "Expand details"An arrow pointing up. May indicate the collapsing of the content below.
Icon.toggleUp "Collapse details"Three-dot in series horizontally. It's usually used in the web to access less commonly used actions.
Icon.moreActions "More actions"For not creating data duplication, Icon.getHint can extract the hint from an Icon.
let
icon =
Icon.seeMore "Read more about this"
in
Element.row []
[ Icon.renderElement renderConfig icon
, Icon.getHint icon
|> Text.body1
|> Text.renderElement renderConfig
]Icons colors can variate to match text color or contrast with a background.
See Palette.color and Palette.setContrasting for how to compose a valid color value.
Icon.search "Search logs"
|> Icon.withColor (Palette.color Palette.tonePrimary Palette.brightnessMiddle)
|> Icon.renderElement renderConfigWith Icon.withSize, you'll be able to scale the icon between the standard sizes.
Icon.withSize Size.large someIcon
NOTE: Default value is Size.medium.
With Icon.withCustomSize, you'll be able to scale the icon using an integer value.
All Icons are constraint to fit inside a 1:1 square.
So the set value also coincides with this square's side length.
E.g., setting Icon.withCustomSize 48 will produce a square with 48px on each side.
Icon.withCustomSize 48 someIconNOTE: Default value is 20.
End of the builder's life. The result of this function is a ready-to-insert Elm UI's Element.
Imports the SVG-spritesheet with all icons into the rendered HTML.
There is no need for using this function when you're using
UI.NavigationContainer, and you should be using it. But, in case you aren't, you need to insert this function on the most top component, which probably is theElement.layout, like this:main : Program Flags Model Msg main = { yourProgram | view = { title = yourPageTitle , body = [ Icon.svgSpriteImport , Element.layout someAttributes yourPageView ] } }
NOTE: Use
UI.NavigationContainer!