import type React from 'react'; import { type AriaAttributes } from 'react'; import { type IconProps } from './icon'; import type { IconName } from './icons.generated'; type BaseProps = { /** * The icon to render in the IconButton using the 1.0 icon system. */ icon: IconName; /** * Use the filled variant of the icon, typically for active or selected states. */ iconFilled?: boolean; /** * The loading strategy for the icon image. * * @default 'lazy' */ iconLoading?: IconProps['loading']; /** * The color of the IconButton * * @default 'neutral' */ color?: 'neutral' | 'destructive' | 'subtle'; /** * The size of the IconButton. * * - `'medium'` — 40 px button, 16 px icon * - `'large'` — 48 px button, 24 px icon * * @default 'medium' */ size?: 'medium' | 'large'; /** * Disables the button. Avoid using disabled buttons whenever possible - instead show error messages explaining the next steps the user should take. */ disabled?: boolean; /** * Custom class name, merged with existing classes. */ className?: string; hidden?: boolean; id?: string; title?: string; dir?: string; lang?: string; slot?: string; style?: React.CSSProperties; tabIndex?: number; }; type VariantProps = { /** * The visual style of the IconButton. * * @default 'outlined' */ variant?: 'outlined' | 'filled' | 'clear'; /** * Allows the background to bleed out into the surrounding layout, * leaving the button to only take up the space for the icon itself. * Only supported on the `clear` variant. * * @default false */ bleed?: boolean; }; type AriaProps = AriaAttributes & ({ 'aria-label': string; 'aria-labelledby'?: never; } | { 'aria-label'?: never; 'aria-labelledby': string; }); type AnchorProps = { href: string; onClick?: never; children?: never; }; type ButtonProps = { href?: never; children?: never; /** * Id of a form element that this button should be associated with. Defaults to the containing * form element. */ form?: string; /** * The URL that processes the information submitted by the button, overriding the `action` attribute of the button's form. */ formAction?: string; /** * Specifies the HTTP method used to submit the form, overriding the `method` attribute of the button's form. */ formMethod?: 'post' | 'get'; /** * The name of the button, submitted as a pair with the button's value as part of the form data. */ name?: string; /** * The value associated with the button's `name` in the form data when the form is submitted using this button. */ value?: string; /** * @default 'button' */ type?: 'submit' | 'button'; /** * Called when the button is clicked. * * If used within a `
`, prefer to set the button to `type=submit` and use the `onSubmit` event on the form * instead. */ onClick?: React.MouseEventHandler; onBlur?: React.FocusEventHandler; onFocus?: React.FocusEventHandler; onKeyDown?: React.KeyboardEventHandler; onKeyUp?: React.KeyboardEventHandler; onPointerDown?: React.PointerEventHandler; onPointerEnter?: React.PointerEventHandler; onPointerLeave?: React.PointerEventHandler; onPointerMove?: React.PointerEventHandler; onPointerUp?: React.PointerEventHandler; onAnimationEnd?: React.AnimationEventHandler; onAnimationStart?: React.AnimationEventHandler; onTransitionEnd?: React.TransitionEventHandler; }; type AsChildProps = { asChild: boolean; children: React.ReactElement; href?: never; onClick?: never; }; export type IconButtonProps = BaseProps & VariantProps & AriaProps & (AnchorProps | ButtonProps | AsChildProps); /** * Base props for localized icon button components. * Excludes conflicting properties that are handled internally by the localized components. */ export type LocalizedIconButtonProps = Omit & { 'aria-label'?: string; }; export declare const IconButton: React.ForwardRefExoticComponent>; export {};