@cerberus-design/react
Version:
The Cerberus Design React component library.
41 lines (40 loc) • 1.09 kB
TypeScript
import { PropsWithChildren } from 'react';
import { CTAModalValue } from './context';
/**
* This module provides the provider and hook for the cta modal.
* @module 'react/cta-modal/provider'
*/
/**
* Provides a CTA modal to the app.
* @see https://cerberus.digitalu.design/react/cta-modal
* @example
* ```tsx
* // Wrap the Provider around the root of the feature.
* <CTAModal>
* <SomeFeatureSection />
* </CTAModal>
*
* // Use the hook to show the cta modal.
* const cta = useCTAModal()
*
* const handleClick = useCallback(async () => {
* const userConsent = await cta.show({
* heading: 'Create or copy a Cohort',
* description:
* 'Create a new cohort or copy and existing one.',
* icon: <Copy size={24} />,
* actions: [
* {
* text: 'Create Cohort',
* onClick: () => {},
* {
* text: 'Copy Cohort',
* onClick: () => {}
* }
* })
* setConsent(userConsent)
* }, [cta])
* ```
*/
export declare function CTAModal(props: PropsWithChildren<object>): import("react/jsx-runtime").JSX.Element;
export declare function useCTAModal(): CTAModalValue;