Skip to content

AlexanderEerenberg/fdmg-ts-react-image-button

 
 

Repository files navigation

Build Status Coverage Status

fdmg-ts-react-image-button

ReactJS ImageButton component. This component renders an image with onClick hook.

Installation

  • Run npm i --save-dev fdmg-ts-react-image-button

or

  • Run yarn add fdmg-ts-react-image-button --dev

Usage

TypeScript

import * as React from 'react';
import ImageButton from 'fdmg-ts-react-image-button';

export default class foo {
    public state: any;
    public props: any;

    constructor(props: any) {
        super(props);
        this.props = props;
    }

    clickHandler() {
        console.info('Image button clicked');
    }

    render() {
        return (
            <ImageButton
                src={"img/button.svg"} 
                onClick={this.clickHandler.bind(this)}
                className="image-btn btn"
                alt="Special button"
            />
        );
    }
}

Resulting HTML

    <img src="img/button.svg" alt="Special button" class="image-btn btn" />

About

ReactJS ImageButton component

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%