I am using the marvelouse react-icons package (http://gorangajic.github.io/react-icons/fa.html), specifically the font awesome package.
If this was not react, then I would just add an attribute to the tag, such as:
<i class="fa fa-camera-retro fa-5x"></i>
However, if I add the fa-5x to the FaFolderOpen tag, it does not do anything. As you can see, I am using react-bootstrap, and placing the icon a button (should it be a block)?
I have to believe this has been asked before, but I did not find it via search.
Here is what it looks like, and I want it larger:
const React = require('react') import { Form, FormControl, FormGroup, ControlLabel, Col, Button, Tooltip, OverlayTrigger } from 'react-bootstrap' import FaFolderOpen from 'react-icons/lib/fa/folder-open' import FaFileCodeO from 'react-icons/lib/fa/file-code-o' import FaFolderOpen from 'react-icons/lib/fa/folder-open' import FaFileCodeO from 'react-icons/lib/fa/file-code-o' <Button type="button" bsStyle="success" block onClick={(e) => folderChooser(e)}> <FaFolderOpen /> </Button>
To increase icon sizes relative to their container, use the fa-lg (33% increase), fa-2x , fa-3x , fa-4x , or fa-5x classes. If your icons are getting chopped off on top and bottom, make sure you have sufficient line-height.
To increase icon sizes relative to their container, use size prop with xs , sm , lg (33% increase), or use literal sizes (to scale it from 1x to 10x) 2x , 3x , 4x , 5x , 6x , 7x , 8x , 9x , 10x . You can make all your icons the same width so they can easily vertically align, like in a list or navigation menu.
if you want a 5x icon size you need to pass it to the react class as size
// Font awesome pixel sizes relative to the multiplier. // 1x - 14px // 2x - 28px // 3x - 42px // 4x - 56px // 5x - 70px <FaFolderOpen size={70} />
if you notice it jumps by 14 each time
from the github readme it shows everything is overridden inline. its rendering a svg so you cant use 5x
you have to use a pixel size
Coming back to this a few years later, with newer versions of FontAwesome/ReactIcons the recommended way to handle different sizings is with their icon provider that utilizes the React Context API. This requires React v16.3+
import { IconContext } from "react-icons"; <IconContext.Provider value={{ className: "shared-class", size: 70 }}> <> <FaFolder /> <FaBeer /> </> </IconContext.Provider>
In reactjs you can use size = 'with your preferred size which be from sm to lg or 1x to 10x'
this is example for font awesome 5 in react
<FontAwesomeIcon icon={faBars} size = '10x'/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With