UNPKG

@carbon/react

Version:

React components for the Carbon Design System

31 lines (29 loc) 842 B
/** * 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 { Text } from "./Text.js"; import "react"; import { jsx } from "react/jsx-runtime"; //#region src/components/Text/createTextComponent.tsx /** * Create a text component wrapper for a given text node type. Useful for * returning a `Text` component for a text node like a `<label>`. * @param {string} element * @param {string} displayName */ const createTextComponent = (element, displayName) => { const TextWrapper = (props) => { return /* @__PURE__ */ jsx(Text, { as: element, ...props }); }; TextWrapper.displayName = displayName; return TextWrapper; }; const Legend = createTextComponent("legend", "Legend"); //#endregion export { Legend };