UNPKG

@carbon/react

Version:

React components for the Carbon Design System

49 lines (45 loc) 1.23 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 PropTypes from 'prop-types'; import React from 'react'; import cx from 'classnames'; import { usePrefix } from '../../internal/usePrefix.js'; const SelectItemGroup = ({ children, className, disabled = false, label, ...other }) => { const prefix = usePrefix(); const classNames = cx(`${prefix}--select-optgroup`, className); return /*#__PURE__*/React.createElement("optgroup", _extends({ className: classNames, label: label, disabled: disabled }, other), children); }; SelectItemGroup.propTypes = { /** * Provide the contents of your <SelectItemGroup> */ children: PropTypes.node, /** * Specify an optional className to be applied to the node */ className: PropTypes.string, /** * Specify whether the <SelectItemGroup> should be disabled */ disabled: PropTypes.bool, /** * Specify the label to be displayed */ label: PropTypes.string.isRequired }; export { SelectItemGroup as default };