import { type ComponentPropsWithoutRef, type ElementType } from 'react'; import { type ButtonSlotRecipeVariant } from '../../styled-system/recipes'; export type ButtonProps = { /** * The content of the button. * Can be any renderable React node. If a string is provided, * it will be wrapped with the Typography component internally. */ children: React.ReactNode; /** * Whether the button is disabled. * If it's provided, the component will be rendered as a button element even if the href prop is provided. * * @default false */ disabled?: boolean; /** * The size of the button. * * @default 'medium' */ size?: ButtonSlotRecipeVariant['size']; /** * The priority of the button. * The style of the button will be changed to indicate the priority. * * @default 'secondary' */ priority?: ButtonSlotRecipeVariant['priority']; /** * Whether the button is destructive. * The style of the button will be changed to indicate that the action is destructive. * * @default false */ destructive?: ButtonSlotRecipeVariant['destructive']; /** * Icon element to be rendered on the left side within the button * Only one element is allowed * * @default undefined */ leftIcon?: React.ReactElement; /** * Whether the button is a dropdown trigger. * A dropdown icon will be rendered on the right side of the button * * @default false */ isDropdownTrigger?: boolean; /** * Whether the button shows a loading indicator. * The button will be disabled and a loading indicator will be shown depending on the size prop. * * @default false */ loading?: boolean; /** * Icon element to be rendered on the right side and before dropdown trigger within the button * Only one element is allowed * * @default undefined */ rightIcon?: React.ReactElement; /** * The path or URL to the linked page. * If it's provided, the component will be rendered as an anchor element. */ href?: string; /** * The component to use as the navigation link instead of the general anchor element ``. * The custom component must extend the HTMLAnchorElement interface. * * Use this property if you want to use a custom component as the link tag. * e.g. next/link */ customLinkComponent?: ElementType; } & ComponentPropsWithoutRef<'button'> & Pick, 'download' | 'hrefLang' | 'ping' | 'rel' | 'target' | 'type' | 'referrerPolicy'>;