import type { ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode } from "react";
type ButtonTone = "primary" | "secondary" | "ghost";
type BaseProps = {
children: ReactNode;
className?: string;
tone?: ButtonTone;
/** Accessible label for screen readers (overrides children text) */
"aria-label"?: string;
/** Indicates if this button is part of a larger grouping */
"aria-haspopup"?: boolean | "menu" | "listbox" | "tree" | "grid" | "dialog";
/** Identifies the element controlled by this button */
"aria-controls"?: string;
/** Identifies the expanded state (for toggle buttons) */
"aria-expanded"?: boolean;
/** Identifies the pressed state (for toggle buttons) */
"aria-pressed"?: boolean;
/** Keyboard navigation: explicit tab index */
tabIndex?: number;
};
type NativeButtonProps = BaseProps &
ButtonHTMLAttributes & {
href?: never;
to?: never;
};
type AnchorButtonProps = BaseProps &
AnchorHTMLAttributes & {
href: string;
to?: never;
};
/**
* Button component with accessibility support and multiple visual tones.
*
* Can be rendered as:
* - `