react-fontawesome-svg-icon
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCalendar as fasCalendar } from '@fortawesome/free-solid-svg-icons';
import { faCalendar as farCalendar } from '@fortawesome/free-regular-svg-icons';
import { faGithub as fabGithub } from '@fortawesome/free-brands-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={fasCalendar} size="lg" />
<FontAwesomeSvgIcon icon={farCalendar} size="lg" />
<FontAwesomeSvgIcon icon={fabGithub} size="lg" />
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={faCoffee} size="xs" />
<FontAwesomeSvgIcon icon={faCoffee} size="sm" />
<FontAwesomeSvgIcon icon={faCoffee} size="lg" />
<FontAwesomeSvgIcon icon={faCoffee} size="1x" />
<FontAwesomeSvgIcon icon={faCoffee} size="2x" />
<FontAwesomeSvgIcon icon={faCoffee} size="3x" />
<FontAwesomeSvgIcon icon={faCoffee} size="4x" />
<FontAwesomeSvgIcon icon={faCoffee} size="5x" />
<FontAwesomeSvgIcon icon={faCoffee} size="6x" />
<FontAwesomeSvgIcon icon={faCoffee} size="7x" />
<FontAwesomeSvgIcon icon={faCoffee} size="8x" />
<FontAwesomeSvgIcon icon={faCoffee} size="9x" />
<FontAwesomeSvgIcon icon={faCoffee} size="10x" />
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<FontAwesomeSvgIcon icon={faCoffee} size="lg" title="Icon title" />
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={faCoffee} size="lg" style={{"backgroundColor":"#2e7dd1","color":"#ffffff","padding":"0.5rem"}} />
<FontAwesomeSvgIcon icon={faCoffee} size="lg" color="#2e7dd1" />
</>
);
export default Example;
import { FunctionComponent } from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faSkating, faSkiing, faSkiingNordic, faSnowboarding, faSnowplow } from '@fortawesome/free-solid-svg-icons';
const Example: FunctionComponent = () => (
<div style={ { fontSize: '1.25rem' } }>
<div><FontAwesomeSvgIcon fixedWidth icon={ faSkating } style={ { background: 'DodgerBlue' } }/> Skating</div>
<div><FontAwesomeSvgIcon fixedWidth icon={ faSkiing } style={ { background: 'SkyBlue' } }/> Skiing</div>
<div><FontAwesomeSvgIcon fixedWidth icon={ faSkiingNordic } style={ { background: 'DodgerBlue' } }/> Nordic Skiing</div>
<div><FontAwesomeSvgIcon fixedWidth icon={ faSnowboarding } style={ { background: 'SkyBlue' } }/> Snowboarding</div>
<div><FontAwesomeSvgIcon fixedWidth icon={ faSnowplow } style={ { background: 'DodgerBlue' } }/> Snowplow</div>
</div>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={faCoffee} size="lg" flip="horizontal" />
<FontAwesomeSvgIcon icon={faCoffee} size="lg" flip="vertical" />
<FontAwesomeSvgIcon icon={faCoffee} size="lg" flip="both" />
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={faCoffee} size="lg" spin />
<FontAwesomeSvgIcon icon={faCoffee} size="lg" pulse />
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faSnowboarding } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={faSnowboarding} size="2x" />
<FontAwesomeSvgIcon icon={faSnowboarding} size="2x" rotation="90" />
<FontAwesomeSvgIcon icon={faSnowboarding} size="2x" rotation="180" />
<FontAwesomeSvgIcon icon={faSnowboarding} size="2x" rotation="270" />
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<FontAwesomeSvgIcon icon={faCoffee} size="lg" inverse />
);
export default Example;
import { FunctionComponent } from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee, faHeart } from '@fortawesome/free-solid-svg-icons';
const Example: FunctionComponent = () => (
<>
<ul className="fa-ul">
<li><FontAwesomeSvgIcon icon={ faCoffee } size="lg" listItem/> Coffee</li>
<li><FontAwesomeSvgIcon icon={ faHeart } size="lg" listItem/> Love</li>
</ul>
</>
);
export default Example;
Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking. — Steve Jobs
It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair. — Charles Dickens, A Tale of Two Cities
import { FunctionComponent } from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faArrowRight, faQuoteLeft } from '@fortawesome/free-solid-svg-icons';
const Example: FunctionComponent = () => (
<>
<p>
<FontAwesomeSvgIcon icon={ faQuoteLeft } size="sm" pull="left"/>
<span>Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking.</span>
—
<i>Steve Jobs</i>
</p>
<p>
<FontAwesomeSvgIcon icon={ faArrowRight } size="lg" pull="right" border/>
<span>It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair.</span>
—
<i>Charles Dickens, A Tale of Two Cities</i>
</p>
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee, faHeart } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<>
<FontAwesomeSvgIcon icon={faCoffee} size="lg" tabIndex="1" />
<FontAwesomeSvgIcon icon={faHeart} size="lg" tabIndex="2" />
</>
);
export default Example;
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const Example = () => (
<FontAwesomeSvgIcon icon={faCoffee} size="lg" swapOpacity />
);
export default Example;
import { useEffect, useRef, useState, FunctionComponent } from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
type Size = { width: number, height: number } | null;
const Example: FunctionComponent = () => {
const [size, setSize] = useState<Size>(null);
const ref = useRef<SVGSVGElement>(null);
useEffect(() => {
if (ref.current) {
const { width, height } = ref.current.getBoundingClientRect();
setSize({ width, height });
}
}, []);
return (
<>
<FontAwesomeSvgIcon ref={ ref } icon={ faCoffee } size="lg"/>
<span>{ size && JSON.stringify(size) }</span>
</>
);
};
export default Example;
import { FunctionComponent } from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee, faHeart } from '@fortawesome/free-solid-svg-icons';
const weirdProgrammingLanguages: string[] = [
'LOLCODE',
'Rockstar',
'TrumpScript',
'Brainf*ck',
'Shakespeare',
'Whitespace',
'Velato',
'Chicken',
'Piet',
'Befunge',
];
const styles = {
container: { display: 'flex' },
title: { flex: 1 },
icon: { width: '1.25rem', height: '1.25rem', margin: '0.5rem' },
};
const Example: FunctionComponent = () => {
return (
<>
<FontAwesomeSvgIcon icon={ faHeart } symbol/>
<FontAwesomeSvgIcon icon={ faCoffee } symbol="beverage-icon"/>
{ weirdProgrammingLanguages.map((language) => (
<div key={ language } style={ styles.container }>
<span style={ styles.title }>{ language }</span>
<svg style={ styles.icon }>
<use xlinkHref="#fas-heart"/>
</svg>
<svg style={ styles.icon }>
<use xlinkHref="#beverage-icon"/>
</svg>
</div>
)) }
</>
);
};
export default Example;