Icon
Use the <Icon> component to easily render <svg> icons. Outkit utilises Streamline as its base icon set and has
provided a comprehensive pool of icons. However this list is not exhaustive.
Icons can be added from the Streamline library (available in Figma). New additions to the Streamline icon set can be logged in the Outkit Jira project here.
Sometimes it is necessary to add additional custom icons outside of the Streamline library.
Avoid passing onClick handlers to the Icon component. If you need a clickable icon, use IconButton
instead.
Import
import { Icon } from '@outfitio/outkit';
Usage
Use an icon by passing the name prop. This name must match an icon key in theme.icons. By default, the icon inherits
the fontSize and color of it's parent.
Icon library
add
add-circle
alarm-bell
alarm-bell-off
alarm-bell-snooze
alarm-clock
alert-diamond
angle-brackets
aprimo
archive-box
archive-locker
arrow-down
arrow-left
arrow-right
arrow-south-east
arrow-south-west
arrow-up
ask-a-question
attachment
back
bin
book-code
book-open
box
brightness
calendar
check
check-circle
chevron-down
chevron-left
chevron-right
chevron-up
choice
circle-cross
clock
close
code
code-2
cog
command
comment
comment-filled
content-paper-edit
copy-paste
cross
cross-circle
cursor
database
document
documents
drop
duplicate
email-action-read
email-action-unread
expand
file-check
file-code-check
file-code-sync
file-stack
filter
flash
folder
folder-open
folder-outline
forward
github
grid-2
hard-drive
headphones
help-float
home
image
image-2
image-file-check
image-file-edit
image-file-lock
image-file-refresh
image-file-status
images
info
layers
layout-1
layout-2
layout-app
layout-cards
layout-rows
layout-split
layout-spreadsheet
letter-spacing
line-height
link
link-broken
link-create
list-bullets
list-number
lock
mailbox
menu
minus
module
modules
more-horizontal
more-horizontal-filled
more-vertical
more-vertical-filled
multiple-users
no
number
open
pen-write
pen-write-paper
pencil
pencil-1
pencil-1-write
pencil-write
pin
play
power
printer
printer-image
question-outline
radioactive
role
screen
search
security
send-email
settings-horizontal
settings-vertical
share
share-2
skull
slack
small-add
small-close
small-flag
small-flag-filled
stack-2
star
star-small
stat
stat-down
stat-up
streamline-add
subtract
subtract-circle
sync-circle
sync-square
tag
task-list
task-list-add
task-list-sync
task-list-warning
team
text
text-cursor
thumbs-down
thumbs-up
tool-box
triangle-down
triangle-up
unlock
user
user-share
view
view-off
warning
warning-2
webhook
wrench
zoom-in
zoom-out
Icon Fallbacks
If you pass an icon name that doesn't exist in theme.icons , you'll see the question-outline icon.
Adding custom icons
All icons are stored in the theme object under the icons key. You can extend this object to add your own icons.
To do this:
- Export the icons as an
svg. - Use a tool like SvgOmg to reduce the size and minify the markup.
- Add the
fill=currentColorattribute to thepathorgso that the icon can be recolored using thecolorprop. - Add the icon to the theme object:
// Step 1: Each icon should be stored as an object of `path` and `viewBox`const customIcons = {icon1: {path: <path fill="currentColor" d="..." />,// If the icon's viewBox is `0 0 24 24`, you can ignore `viewBox`viewBox: "0 0 40 40",},icon2: {path: (<g fill="currentColor"><path d="..." /></g>) } };// Step 2: Add the custom icon to the themeconst customTheme = {...theme,icons: {...theme.icons,...customIcons,}}// Step 3: Pass the new theme to the ThemeProvider<ThemeProvider theme={customTheme}>{/* app goes here */}</ThemeProvider>// Step 4: Now you can do this<Icon name="icon1" color="success.200" />
Accessibility
- Pair text and icons for clarity
- Give icons a text equivalent if its purpose isn’t conveyed in another way
Props
Icon component composes Box so you can pass all Box props.
| Name | Type | Default | Description |
|---|---|---|---|
size | string | 1em | The size of the icon. |
name | string | The name of the icon. | |
color | string | currentColor | The color of the icon. |
focusable | boolean | false | Denotes that the icon is not an interative element, and only used for presentation. |
role | presentation, img | presentation | The html role of the icon. |