UI.Icon is an implementation of icons using an SVG-spritesheet.
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.
NOTE: The spritesheet is automatically injected when using UI.Document.toBrowserDocument
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.
Icon constructor.
Icon.arrowCurveLeft "Accessibility hint"Icon constructor.
Icon.arrowRight "Accessibility hint"Icon constructor.
Icon.boltDisabled "Accessibility hint"Icon constructor.
Icon.boxOutlined "Accessibility hint"Icon constructor.
Icon.boxesFilled "Accessibility hint"Icon constructor.
Icon.boxesOutlined "Accessibility hint"Icon constructor.
Icon.checkmarkCircle "Accessibility hint"Icon constructor.
Icon.checkmarkRoundedRectangle "Accessibility hint"Icon constructor.
Icon.chevronDown "Accessibility hint"Icon constructor.
Icon.chevronLeft "Accessibility hint"Icon constructor.
Icon.chevronRight "Accessibility hint"Icon constructor.
Icon.clockIssue "Accessibility hint"Icon constructor.
Icon.clockLocked "Accessibility hint"Icon constructor.
Icon.closeCircle "Accessibility hint"Icon constructor.
Icon.closeRoundedRectangle "Accessibility hint"Icon constructor.
Icon.directions "Accessibility hint"Icon constructor.
Icon.legacyApis "Accessibility hint"Icon constructor.
Icon.legacyHistorical "Accessibility hint"Icon constructor.
Icon.legacyLabelPrinter "Accessibility hint"Icon constructor.
Icon.legacyReport "Accessibility hint"Icon constructor.
Icon.legacyRetailerDashboard "Accessibility hint"Icon constructor.
Icon.legacySignOut "Accessibility hint"Icon constructor.
Icon.mapPinRadius "Accessibility hint"Icon constructor.
Icon.messageLock "Accessibility hint"Icon constructor.
Icon.messageOTP "Accessibility hint"Icon constructor.
Icon.microphoneMute "Accessibility hint"Icon constructor.
Icon.microphone "Accessibility hint"Icon constructor.
Icon.notification "Accessibility hint"Icon constructor.
Icon.personAssign "Accessibility hint"Icon constructor.
Icon.personAssigned "Accessibility hint"Icon constructor.
Icon.personError "Accessibility hint"Icon constructor.
Icon.personUnassign "Accessibility hint"Icon constructor.
Icon.personsAdd "Accessibility hint"Icon constructor.
Icon.phoneEndCall "Accessibility hint"Icon constructor.
Icon.phoneStartCall "Accessibility hint"Icon constructor.
Icon.placeholder "Accessibility hint"Icon constructor.
Icon.printerError "Accessibility hint"Icon constructor.
Icon.scanBarcode "Accessibility hint"Icon constructor.
Icon.scanPackage "Accessibility hint"Icon constructor.
Icon.spaceError "Accessibility hint"Icon constructor.
Icon.spaceSearch "Accessibility hint"Icon constructor.
Icon.speakerMute "Accessibility hint"A person with a plus sign on the bottom-right.
Icon.assingPerson "Select Manager"A check mark, commonly used inside checkboxes and radio buttons.
Icon.check "Notepad"NOTE: Deprecated name.
A gear. Usually used for opening settings managers.
Icon.configure "Open display settings"NOTE: Deprecated name.
A chat-like baloon. In Paack's apps this symbolizes the log of actions.
Icon.eventLog "Events"NOTE: Deprecated name.
A thunder bolt.
Icon.fixIssues "Fix issues from selected groups"NOTE: Deprecated name.
Three-dot in series horizontally. It's usually used in the web to access less commonly used actions.
Icon.moreActions "More actions"NOTE: Deprecated name.
An arrow pointing to the right used in chevrons and paginators.
Icon.nextContent "Next page"NOTE: Deprecated name.
A bell for indicating notifications.
Icon.notifications "See notifications"NOTE: Deprecated name.
Internal jargon in Paack.
Icon.paackSpaces "Spaces"NOTE: Deprecated name.
An arrow pointing to the left used in chevrons and paginators.
Icon.previousContent "Previous page"NOTE: Deprecated name.
An A4 ink printer. Indicates the availability to print something related to the surrounding content.
Icon.print "Printer pacakage's barcode"NOTE: Deprecated name.
Tree-bar stacked vertically. It's usually used in mobile to toggle left bar menus.
Icon.sandwichMenu "Open pages menu"NOTE: Deprecated name.
The space icon with a search icon in the right-bottom.
Icon.searchSpace "Search Space"NOTE: Deprecated name.
Ellipsis (three-dots horizontally aligned). For showing hidden details.
Icon.seeMore "Read more about this article"NOTE: Deprecated name.
An arrow pointing up.
Icon.sortDecreasing "Sort from Z to A"NOTE: Deprecated name.
An arrow pointing down.
Icon.sortIncreasing "Sort from A to Z"NOTE: Deprecated name.
A check mark in circle, commonly used to indicate a success state.
Icon.success "Success"NOTE: Deprecated name.
A foldable paper, toggle some content between showing/hiding, or full/collapsed.
Icon.toggle "Expand technical details"NOTE: Deprecated name.
An arrow pointing down. May indicate the expansion of a hidden content below.
Icon.toggleDown "Expand details"NOTE: Deprecated name.
An arrow pointing up. May indicate the collapsing of the content below.
Icon.toggleUp "Collapse details"NOTE: Deprecated name.
A person with a plus sign on the bottom-right.
Icon.assingPerson "Select Manager"NOTE: Deprecated name.
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.Document, 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.Document!