Socket
Socket
Sign inDemoInstall

@paprika/button-group

Package Overview
Dependencies
94
Maintainers
3
Versions
103
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/button-group

ButtonGroup component is a segmented group of toggle buttons.


Version published
Weekly downloads
915
increased by8.8%
Maintainers
3
Install size
3.40 MB
Created
Weekly downloads
 

Readme

Source

@paprika/button-group

Description

ButtonGroup component is a segmented group of toggle buttons.

Installation

yarn add @paprika/button-group

or with npm:

npm install @paprika/button-group

Props

ButtonGroup

PropTyperequireddefaultDescription
childrennodefalsenullThe toggle buttons in the group.
hasIconsboolfalsefalseTo show the icons used for selected / not selected.
isDisabledboolfalsefalseIf the entire button group is disabled.
isFullWidthboolfalsefalseIf the width of the button group should stretch to fit its parent container (100%).
isMultiboolfalsefalseIf multiple simultaneous selections are allowed.
isSemanticboolfalsetrueIf it will be rendered as a button element. If false, a span will be rendered via an accessible RawButton.
onChangefuncfalse() => {}Callback to be executed when any button item is clicked or activated by keyboard. It will return an array of the selected items' "value" properties.
size[ ButtonGroup.types.size.SMALL, ButtonGroup.types.size.MEDIUM, ButtonGroup.types.size.LARGE]falseButtonGroup.types.size.MEDIUMSize of the buttons (height, font size, etc).

ButtonGroup.Item

PropTyperequireddefaultDescription
childrennodefalsenullContent label of the button to be displayed.
defaultIsActiveboolfalsefalseIf the item is active or on selected state
value[string,number]true-Unique key to represent the selected value.

Usage

import ButtonGroup from "@paprika/button-group";

const yourComponent = () => {
  const handleChange = selectedValues => {
    // do something with array of selected values
  };

  return (
    <ButtonGroup onChange={handleChange}>
      <ButtonGroup.Item value={1} defaultIsSelected>
        One
      </ButtonGroup.Item>
      <ButtonGroup.Item value={2}>Two</ButtonGroup.Item>
      <ButtonGroup.Item value={3}>Three</ButtonGroup.Item>
    </ButtonGroup>
  );
};
  • Storybook Showcase
  • GitHub source code
  • Create GitHub issue
  • CHANGELOG

FAQs

Last updated on 22 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc