/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { EuiText } from "@elastic/eui"; interface EuiFormCustomLabelProps { title: string; helpText?: string; learnMore?: JSX.Element | null | undefined; textStyle?: object; headerStyle?: object; isInvalid?: boolean; isOptional?: boolean; } // New pattern for label and help text both being above the form row instead of label above and help below. const EuiFormCustomLabel = ({ title, helpText, learnMore = null, textStyle = { marginBottom: "5px" }, headerStyle = { marginBottom: "2px" }, isInvalid = false, isOptional = false, }: EuiFormCustomLabelProps) => (
{title} {isOptional ? ( – optional ) : null}

{" "} {/* Keep the

tag even if no helpText to remove last child styling on h tags */} {helpText && ( {helpText} {learnMore} )}

); export default EuiFormCustomLabel;