UNPKG

@carbon/react

Version:

React components for the Carbon Design System

43 lines (41 loc) 1.2 kB
/** * Copyright IBM Corp. 2016, 2026 * * 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 { usePrefix } from "../../internal/usePrefix.js"; import classNames from "classnames"; import "react"; import PropTypes from "prop-types"; import { jsx } from "react/jsx-runtime"; //#region src/components/SelectItem/SelectItem.tsx /** * Copyright IBM Corp. 2016, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ const SelectItem = ({ className, value = "", disabled = false, hidden = false, text = "", ...other }) => { const selectItemClasses = classNames({ [`${usePrefix()}--select-option`]: true, ...className && { [className]: className } }); return /* @__PURE__ */ jsx("option", { ...other, className: selectItemClasses, value, disabled, hidden, children: text }); }; SelectItem.propTypes = { className: PropTypes.string, disabled: PropTypes.bool, hidden: PropTypes.bool, text: PropTypes.string.isRequired, value: PropTypes.any.isRequired }; //#endregion export { SelectItem as default };