1602/elm-feather/2.3.2

NOTE: the latest version is 2.3.5

FeatherIcons

Basic Usage

Using a feather icon in your view is as easy as:

featherIcon : Html msg
featherIcon =
    FeatherIcons.feather
        |> FeatherIcons.toHtml []

Change FeatherIcons.feather by the icon you prefer, a list of all icons is visible here: https://1602.github.io/elm-feather-icons/

All icons of this package are provided as the internal type Icon. To turn them into an Html msg, simply use the toHtml function.

type Icon

Opaque type representing icon builder

toHtml : List (Attribute msg) -> Icon -> Html msg

Build icon, ready to use in html. It accepts list of svg attributes, for example in case if you want to add an event handler.

-- default
Icon.download
    |> Icon.toHtml []


-- with some attributes
Icon.download
    |> Icon.withSize 10
    |> Icon.withClass "icon-download"
    |> Icon.toHtml [ onClick Download ]

Customize Icons

Feather icons are 24px size by default, and come with two css classes, feather and feather-"icon-name". For the aperture icon for example, this will be: feather feather-aperture.

To customize it's class and size attributes simply use the withClass and withSize functions before turning them into Html with toHtml.

withClass : String -> Icon -> Icon

Overwrite class attribute of an icon

Icon.download
    |> Icon.withClass "icon-download"
    |> Icon.toHtml []
withSize : Float -> Icon -> Icon

Set size attribute of an icon

Icon.download
    |> Icon.withSize 10
    |> Icon.toHtml []
withSizeUnit : String -> Icon -> Icon

Set unit of size attribute of an icon, one of: "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%"

Icon.download
    |> Icon.withSize 50
    |> Icon.withSizeUnit "%"
    |> Icon.toHtml []
withStrokeWidth : Float -> Icon -> Icon

Set thickness of icon lines, useful when inlining icons with bold / normal text.

Icon.playCircle
    |> Icon.withStrokeWidth 1
    |> Icon.toHtml []

New Custom Icons

If you'd like to use same API while creating personally designed icons, you can use the customIcon function. You have to provide it with a List (Svg Never) that will be embedded into the icon.

customIcon : List (Svg Never) -> Icon

Build custom svg icon

[ Svg.line [ x1 "21", y1 "10", x2 "3", y2 "10" ] []
, Svg.line [ x1 "21", y1 "6", x2 "3", y2 "6" ] []
, Svg.line [ x1 "21", y1 "14", x2 "3", y2 "14" ] []
, Svg.line [ x1 "21", y1 "18", x2 "3", y2 "18" ] []
]
    |> customIcon
    |> withSize 26
    |> withViewBox "0 0 26 26"
    |> toHtml []

Example output:

withViewBox : String -> Icon -> Icon

Set viewBox attribute for a custom icon

Icon.custom [ customSvgPathFittingWithin100pxSquare ]
    |> Icon.withViewBox "0 0 100 100"
    |> Icon.toHtml []

Feather Icons List

activity

airplay

alert-circle

alert-octagon

alert-triangle

align-center

align-justify

align-left

align-right

anchor

aperture

archive

arrow-down-circle

arrow-down-left

arrow-down-right

arrow-down

arrow-left-circle

arrow-left

arrow-right-circle

arrow-right

arrow-up-circle

arrow-up-left

arrow-up-right

arrow-up

at-sign

award

bar-chart-2

bar-chart

battery-charging

battery

bell-off

bell

bluetooth

bold

book-open

book

bookmark

box

briefcase

calendar

camera-off

camera

cast

check-circle

check-square

check

chevron-down

chevron-left

chevron-right

chevron-up

chevrons-down

chevrons-left

chevrons-right

chevrons-up

chrome

circle

clipboard

clock

cloud-drizzle

cloud-lightning

cloud-off

cloud-rain

cloud-snow

cloud

code

codepen

command

compass

copy

corner-down-left

corner-down-right

corner-left-down

corner-left-up

corner-right-down

corner-right-up

corner-up-left

corner-up-right

cpu

credit-card

crop

crosshair

database

delete

disc

dollar-sign

download-cloud

download

droplet

edit-2

edit-3

edit

eye-off

eye

facebook

fast-forward

feather

file-minus

file-plus

file-text

file

film

filter

flag

folder-minus

folder-plus

folder

gift

git-branch

git-commit

git-merge

git-pull-request

github

gitlab

globe

grid

hard-drive

hash

headphones

heart

help-circle

home

image

inbox

info

instagram

italic

layers

layout

life-buoy

link-2

linkedin

list

loader

lock

log-in

log-out

mail

map-pin

map

maximize-2

maximize

message-circle

message-square

mic-off

mic

minimize-2

minimize

minus-circle

minus-square

minus

monitor

moon

more-horizontal

more-vertical

move

music

octagon

package

paperclip

pause-circle

pause

percent

phone-call

phone-forwarded

phone-incoming

phone-missed

phone-off

phone-outgoing

phone

pie-chart

play-circle

play

plus-circle

plus-square

plus

pocket

power

printer

radio

refresh-ccw

refresh-cw

repeat

rewind

rotate-ccw

rotate-cw

rss

save

scissors

send

server

settings

share-2

share

shield-off

shield

shopping-bag

shopping-cart

shuffle

skip-back

skip-forward

slack

slash

sliders

smartphone

speaker

square

star

stop-circle

sun

sunrise

sunset

tablet

tag

target

terminal

thermometer

thumbs-down

thumbs-up

toggle-left

toggle-right

trash-2

trash

trending-down

trending-up

triangle

truck

tv

twitter

type

umbrella

underline

unlock

upload-cloud

upload

user-check

user-minus

user-plus

user-x

user

users

video-off

video

voicemail

volume-1

volume-2

volume-x

volume

watch

wifi-off

wifi

wind

x-circle

x-square

x

youtube

zap-off

zap

zoom-in

zoom-out