Icon component
Examples
Check out the Usage section for details about how to design an icon properly, and the different configuration options we provide.
Basic Example
You can use one of the pre-made icons. See the List of icons for the full range of options.
<Icon icon="<ICON-ID>" />
Custom Example
You can extend the component to render a custom icon. In order to use it, it must first be added as a custom icon option.
Steps to add a custom icon
- Create a folder to store your custom icons. We recommend using
src/assets/icons
. - Add an SVG file to the folder, for example
cust-helicopter.svg
.
- Use the
cust-
prefix for your custom icons. - The name of the file has to be the same as the
id
inside the SVG file.
- Add the path to the icons folder in your
.env
file:
Webpack 5
JUTRO_APP_CLIENT_ICONS_PATH=./src/assets/icons
Webpack 4
ICONS_PATH=./src/assets/icons
- Use the icon you created in the component:
{
"id": "icon",
"type": "element",
"component": "Icon",
"componentProps": {
"size": "large",
"icon": "cust-helicopter"
}
}
<Icon icon="cust-helicopter" />
Usage
The Icon
component renders a single icon. Webpack loads the icon as a symbol at the top of the page and the browser calculates the proper SVG in place.
The icon
prop takes the name of the icon. You have the following options:
- Use a Guidewire icon, like
gw-account-circle
. Guidewire icons use thegw-
prefix, and you can look them up here. - Extend the
Icon
component to use a custom icon. - Globally replace a Guidewire icon.
Override a Guidewire icon
You can replace a Guidewire icon with your custom one. This overrides all occurrences of this icon in your app.
- Create a folder to store your custom icons. We recommend using
src/assets/icons
. - Add an SVG file to the folder, for example
gw-account.svg
.
- Use the
gw-
prefix to override a Guidewire icon. - Match an existing name for a Guidewire icon. You can look up available icons here.
- The name of the file has to be the same as the
id
inside the SVG file.
- Add the path to the icons folder in your
.env
file:
ICONS_PATH=./src/assets/icons
Migrating from material to Guidewire icons
You can replace your material icons with Guidewire icons by simply replacing the value of the icon prop with the name of a Guidewire icon. But Guidewire icons are rendered differently, so you may need to adjust some of your code or tests.
If you use a material icon, Jutro app renders it like this:
<i class="mir mi-account-circle"></i>
However, if you use a Guidewire icon, Jutro app renders it like this:
<svg
class="jut__Icon__svgIcon gw gw-account-circle"
viewBox="0 0 1024 1024"
role="img"
aria-label="account-circle icon">
<use href="#gw-account-circle"></use>
</svg>
This can influence your code or tests if:
- You use selectors in your CSS to match any of the elements rendered by the icon component.
- Your app logic depends on the HTML structure of the icon.
Icon mapping
The following is a list of Material UI icons and their Jutro equivalents. You can view the full list of icons on the List of icons page.
mi-access-time
:gw-access-time
mi-accessible
:gw-accessible
mi-account-balance
:gw-account-balance
mi-account-box
:gw-accounts
mi-account-circle
:gw-account-circle
mi-account-tree
:gw-account-tree
mi-add
:gw-add
mi-add-circle
:gw-add-circle
mi-add-circle-outline
:gw-add-circle-outline
mi-add-a-photo
:gw-add-a-photo
mi-alarm
:gw-alarm
mi-apps
:gw-apps
mi-archive
:gw-archive
mi-arrow-forward
:gw-arrow-forward
mi-assignment
:gw-assignment
mi-assignment-turned-in
:gw-submission
mi-attach-file
:gw-attach-file
mi-autorenew
:gw-renewals
mi-bathtub
:gw-bathtub
mi-block
:gw-block
mi-bookmark
:gw-bookmark
mi-bookmark-border
:gw-bookmark-border
mi-boundary
:gw-boundary
mi-brightness1
:gw-brightness1
mi-business
:gw-business
mi-business-center
:gw-business-center
mi-build
:gw-build
mi-call-split
:gw-call-split
mi-calendar-today
:gw-calendar-today
mi-cancel
:gw-cancel
mi-change-history
:gw-edition
mi-chat
:gw-chat
mi-check
:gw-check
mi-check-box-outline-blank
:gw-check-box-outline-blank
mi-check-circle
:gw-check-circle
mi-check-circle-outline
:gw-check-circle-outline
mi-chevron-left
:gw-chevron-left
mi-chevron-right
:gw-chevron-right
mi-clear
:gw-clear
mi-close
:gw-close
mi-cloud-done
:gw-cloud-done
mi-cloud-queue
:gw-cloud-queue
mi-cloud-download
:gw-cloud-download
mi-cloud-upload
:gw-cloud-upload
mi-code
:gw-code
mi-columns
:gw-columns
mi-comment
:gw-review
mi-credit-card
:gw-credit-card
mi-dashboard
:gw-dashboard
mi-delete
:gw-delete
mi-delete-outline
:gw-delete-outline
mi-details
:gw-details
mi-description
:gw-description
mi-details
:gw-details
mi-directions-boat
:gw-directions-boat
mi-directions-car
:gw-directions-car
mi-done
:gw-check
mi-done-all
:gw-done-all
mi-drag-handle
:gw-drag-handle
mi-drag-indicator
:gw-drag-indicator
mi-edit
:gw-edit
mi-email
:gw-email
mi-error
:gw-error
mi-error-outline
:gw-error-outline
mi-expand-less
:gw-expand-less
mi-expand-more
:gw-expand-more
mi-file-copy
:gw-file-copy
mi-file-download
:gw-file-download
mi-file-upload
:gw-file-upload
mi-filter-list
:gw-filter-list
mi-find-in-page
:gw-find-in-page
mi-flag
:gw-flag
mi-flight-takeoff
:gw-flight-takeoff
mi-format-align-center
:gw-format-align-center
mi-format-align-left
:gw-format-align-left
mi-format-align-right
:gw-format-align-right
mi-format-list-numbered
:gw-queues
mi-folder
:gw-folder
mi-gavel
:gw-gavel
mi-grid-on
:gw-grid-on
mi-grid-off
:gw-grid-off
mi-help
:gw-help
mi-help-outline
:gw-help-outline
mi-home
:gw-home
mi-home-work
:gw-home-work
mi-info
:gw-info
mi-insert-drive-file
:gw-insert-drive-file
mi-insert-link
:gw-insert-link
mi-keyboard-arrow-down
:gw-keyboard-arrow-down
mi-keyboard-arrow-up
:gw-keyboard-arrow-up
mi-keyboard-arrow-left
:gw-keyboard-arrow-left
mi-keyboard-arrow-right
:gw-keyboard-arrow-right
mi-keyboard-back
:gw-keyboard-backspace
mi-keyboard-backspace
:gw-keyboard-backspace
mi-label
:gw-quote
mi-link
:gw-link
mi-link-off
:gw-link-off
mi-list
:gw-list
mi-list-alt
:gw-coverages
mi-local-shipping
:gw-local-shipping
mi-lock
:gw-lock
mi-lock-open
:gw-lock-open
mi-mail
:gw-mail
mi-mail-outline
:gw-mail-outline
mi-menu
:gw-menu
mi-message
:gw-message
mi-more-horiz
:gw-more-horizontal
mi-more-vertical
:gw-more-vertical
mi-movie
:gw-movie
mi-notes
:gw-note
mi-not-interested
:gw-not-interested
mi-notifications
:gw-notifications
mi-notifications-active
:gw-notifications-active
mi-notifications-none
:gw-notifications-none
mi-open-in-new
:gw-open-in-new
mi-outlined-flag
:gw-outlined-flag
mi-person
:gw-person
mi-person-add
:gw-person-add
mi-people
:gw-people
mi-pageview
:gw-pageview
mi-perm-contact-calendar
:gw-perm-contact-calendar
mi-phone
:gw-phone
mi-photo
:gw-photo
mi-photo-camera
:gw-photo-camera
mi-print
:gw-print
mi-publish
:gw-publish
mi-receipt
:gw-receipt
mi-redo
:gw-redo
mi-refresh
:gw-refresh
mi-reorder
:gw-reorder
mi-remove
:gw-remove
mi-remove-from-queue
:gw-reverted
mi-search
:gw-search
mi-settings
:gw-settings
mi-share
:gw-share
mi-star
:gw-star
mi-star-border
:gw-star-border
mi-store
:gw-store
mi-summarize
:gw-summary
mi-sync
:gw-sync
mi-sync-alt
:gw-policy-transactions
mi-translate
:gw-translate
mi-thumb-up
:gw-validation
mi-timeline
:gw-timeline
mi-tonality
:gw-tonality
mi-tune
:gw-tune
mi-unarchive
:gw-unarchive
mi-unfold-less
:gw-unfold-less
mi-unfold-more
:gw-unfold-more
mi-unpublish
:gw-unpublish
mi-view-module
:gw-view-module
mi-view-list
:gw-view-list
mi-view-warning
:gw-view-warning
mi-visibility
:gw-visibility
mi-visibility-off
:gw-visibility-off
mi-arrow-drop-up
:gw-expand-less
mi-arrow-drop-down
:gw-expand-more
mi-view-column
:gw-view-column
mi-warning
:gw-warning
mi-more-vert
:gw-more-vertical
mi-create
:gw-edit
The following Jutro icons have no equivalents in Material UI.
gw-additional-interests
gw-arrow-down-circle
gw-cc-discover
gw-cc-mastercard
gw-cc-visa
gw-cc-amex
gw-code-branch
gw-coverage
gw-customer-service
gw-driver-license
gw-info-outline
gw-policy
gw-relationship
gw-spinner
gw-subtopic
gw-topic
gw-sync-success
gw-undo
gw-user-info
gw-facebook
gw-instagram
gw-twitter
gw-youtube
Code
<Icon icon="<ICON-ID>" />
Import statement
import { Icon } from '@jutro/components';
Component contract
Make sure to understand the Design System components API surface, and the implications and trade-offs. Learn more in our introduction to the component API.
Properties
icon
required- Type
string
Descriptionicon name to be used.
className
- Type
string
DescriptionCSS class name for this component.
id
- Type
string
DescriptionComponent unique identifier
size
- Type
'small', 'medium' 'large'
DescriptionDetermines the size of icon.
color
deprecated- Type
string
DescriptionDetermines the color (HEX code) of icon.
tag
deprecated- Type
string
DescriptionTag used to render icon.
Hooks
No hooks are available for Icon.
Translation keys
There are no translations for Icon.
For information on how to manage translations, see our section about Internationalization.
Escape Hatches
For more information, see our documentation about escape hatches.