1.1.1 • Published 5 years ago

@ramonak/react-button-group v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@ramonak/react-button-group

React ButtonGroup component with the selection (active button) functionality

NPM JavaScript Style Guidenpm bundle sizeGitHubnpm


demo


Install

npm install --save @ramonak/react-button-group

Usage

import React from 'react'
import ButtonGroup from '@ramonak/react-button-group'
import '@ramonak/react-button-group/dist/index.css';

const Example = () => {
  const handleClick = (e) => {
    console.log(e.target.name);
  };

  return <ButtonGroup
            buttons={['One', 'Two', 'Three', 'Four']}
            onButtonClick={handleClick}
          />
}

Props

NameTypeDefaultDescription
buttons (required)Array of stringsLabels of buttons. For buttons without labels pass an array with empty strings.
orientationstring: horizontal, verticalhorizontalOrientation of button group: vertical or horizontal display
onButtonClickfunctionFunction that runs on a button click
containerClassNamestringClass name for custom styles of a wrapper div
buttonClassNamestringClass name for custom styles of a button inside a button group
activeButtonClassNamestringClass name for custom styles of an active (selected) button inside a button group

License

MIT © KaterinaLupacheva