UNPKG

@carbon/react

Version:

React components for the Carbon Design System

48 lines (44 loc) 1.26 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import { usePrefix } from '../../internal/usePrefix.js'; const ButtonSet = /*#__PURE__*/forwardRef((props, ref) => { const { children, className, stacked, ...rest } = props; const prefix = usePrefix(); const buttonSetClasses = cx(className, `${prefix}--btn-set`, { [`${prefix}--btn-set--stacked`]: stacked }); return /*#__PURE__*/React.createElement("div", _extends({}, rest, { className: buttonSetClasses, ref: ref }), children); }); ButtonSet.displayName = 'ButtonSet'; ButtonSet.propTypes = { /** * Specify the content of your ButtonSet */ children: PropTypes.node, /** * Specify an optional className to be added to your ButtonSet */ className: PropTypes.string, /** * Specify the button arrangement of the set (vertically stacked or * horizontal) */ stacked: PropTypes.bool }; export { ButtonSet as default };