@carbon/react
Version:
React components for the Carbon Design System
52 lines (46 loc) • 1.38 kB
JavaScript
/**
* 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.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var PropTypes = require('prop-types');
var cx = require('classnames');
var usePrefix = require('../../internal/usePrefix.js');
const ButtonSet = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
children,
className,
stacked,
...rest
} = props;
const prefix = usePrefix.usePrefix();
const buttonSetClasses = cx(className, `${prefix}--btn-set`, {
[`${prefix}--btn-set--stacked`]: stacked
});
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.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
};
exports.default = ButtonSet;