UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

20 lines 1.05 kB
import React from 'react'; type CSSModulesProps = { as?: string | React.ComponentType<any>; sx?: React.CSSProperties; }; /** * Utility to toggle rendering a styled component or a "plain" component based * on the provided `as` prop. When the provided feature flag is enabled, the * props will be passed through to an element or component created with the `as` * prop. When it is disabled, the provided styled component is used instead. * * @param flag - the feature flag that will control whether or not the provided * styled component is used * @param defaultAs - the default component to use when `as` is not provided * @param Component - the styled component that will be used if the feature flag * is disabled */ export declare function toggleStyledComponent<T, P extends CSSModulesProps>(flag: string, defaultAs: string | React.ComponentType<any>, Component: React.ComponentType<P>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>; export {}; //# sourceMappingURL=toggleStyledComponent.d.ts.map