diff --git a/packages/ibm-products/src/components/CoachmarkButton/CoachmarkButton.js b/packages/ibm-products/src/components/CoachmarkButton/CoachmarkButton.tsx similarity index 66% rename from packages/ibm-products/src/components/CoachmarkButton/CoachmarkButton.js rename to packages/ibm-products/src/components/CoachmarkButton/CoachmarkButton.tsx index 379694ec3c..3e57d3c2bd 100644 --- a/packages/ibm-products/src/components/CoachmarkButton/CoachmarkButton.js +++ b/packages/ibm-products/src/components/CoachmarkButton/CoachmarkButton.tsx @@ -19,6 +19,17 @@ import { useCoachmark } from '../Coachmark'; // Carbon and package components we use. /* TODO: @import(s) of carbon components and other package components. */ +interface CoachmarkButtonProps { + /** + * Provide an optional class to be applied to the containing node. + */ + className?: string; + /** + * The aria label. + */ + label: string; +} + // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--coachmark-button`; const componentName = 'CoachmarkButton'; @@ -42,43 +53,44 @@ const componentName = 'CoachmarkButton'; /** * Use CoachmarkButton for the target prop of a Coachmark component. */ -export let CoachmarkButton = React.forwardRef( - ({ className, label, ...rest }, ref) => { - const coachmark = useCoachmark(); - if (!coachmark) { - return ( -
- CoachmarkButton is to be use exclusively within the target prop of - Coachmark -
- ); - } +export let CoachmarkButton = React.forwardRef< + HTMLButtonElement, + CoachmarkButtonProps +>(({ className, label, ...rest }, ref) => { + const coachmark = useCoachmark(); + if (!coachmark) { return ( - +
+ CoachmarkButton is to be use exclusively within the target prop of + Coachmark +
); } -); + return ( + + ); +}); // Return a placeholder if not released and not enabled by feature flag CoachmarkButton = pkg.checkComponentEnabled(CoachmarkButton, componentName);