@devopness/ui-react
Version:
Devopness Design System React Components - Painless essential DevOps to everyone
41 lines (40 loc) • 1.4 kB
TypeScript
import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import { ToggleContentButtonProps } from './ToggleContentButton';
/**
* Props for the `ToggleContent` component.
*/
type ToggleContentProps = {
/** Whether the content is sensitive (hides by default)
* @default false
*/
isSensitiveContent?: boolean;
/** Show warning when revealing sensitive content
* @default false
*/
showWarning?: boolean;
/** Placeholder to show when content is hidden */
hiddenContentPlaceholder?: ReactNode;
/** Whether to show the hidden content placeholder
* @default true
*/
showHiddenContentPlaceholder?: boolean;
/** Optional container props */
containerProps?: HTMLAttributes<HTMLDivElement>;
/** Props for the toggle button */
buttonProps?: ToggleContentButtonProps;
};
/**
* Component to show/hide sensitive content with a toggle button.
*
* @example
* <ToggleContent
* isSensitiveContent
* showWarning
* hiddenContentPlaceholder="*****"
* >
* <span>Secret value</span>
* </ToggleContent>
*/
declare const ToggleContent: ({ isSensitiveContent, showWarning, hiddenContentPlaceholder, showHiddenContentPlaceholder, containerProps, buttonProps, children, }: PropsWithChildren<ToggleContentProps>) => import("react/jsx-runtime").JSX.Element;
export { ToggleContent };
export type { ToggleContentProps };