Simple React component including two buttons to increae and decrease font size of a target text
npm install react-font-size-changernpm install --save react-font-size-changer
JavaScript
import React, { Component } from 'react';
import FontSizeChanger from 'react-font-size-changer';
class App extends Component {
render() {
return (
targets={['#target .content']}
onChange={(element, newValue, oldValue) => {
console.log(element, newValue, oldValue);
}}
options={{
stepSize: 2,
range: 3
}}
customButtons={{
up: A,
down: A,
style: {
backgroundColor: 'red',
color: 'white',
WebkitBoxSizing: 'border-box',
WebkitBorderRadius: '5px',
width: '60px'
},
buttonsMargin: 10
}}
/>
This is the title of my target text
This is the content of my target text
);
}
}
``