Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-bootstrap button with icon

I can add a button with text in react-bootstrap using code like

        <Button
          className={styles.feedbackButtonRating}
          variant={this.state.liked ? 'success' : 'light'}
          onClick={this.handleOnLikeClick}
        >
          {FEEDBACK_LIKE_BUTTON_TEXT}
        </Button>

Is there a way to replace {FEEDBACK_LIKE_BUTTON_TEXT} text with a thumb up icon?

like image 964
sixtytrees Avatar asked Nov 28 '19 08:11

sixtytrees


2 Answers

You can try out using this npm package react-icons

import { FaThumbsUp } from 'react-icons/fa';

<Button>
    <FaThumbsUp />
</Button>
like image 71
Hendro Avatar answered Sep 20 '22 08:09

Hendro


You can use font awesome library (npm-pakage) for reactjs.

Link : Font-awesome for reactjs

USE -

import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

<FontAwesomeIcon icon="signal" />
<FontAwesomeIcon icon="globe" />
like image 21
Alok Mali Avatar answered Sep 22 '22 08:09

Alok Mali