@carbon/react
Version:
React components for the Carbon Design System
29 lines (25 loc) • 655 B
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.
*/
import PropTypes from 'prop-types';
import React from 'react';
import { IdPrefixContext } from '../../internal/useIdPrefix.js';
function IdPrefix({
children,
prefix
}) {
return /*#__PURE__*/React.createElement(IdPrefixContext.Provider, {
value: prefix
}, children);
}
IdPrefix.propTypes = {
children: PropTypes.node,
/**
* The value used to prefix the auto-generated id placed on some DOM elements
*/
prefix: PropTypes.string
};
export { IdPrefix };