/** * Button primitive for focusable buttons. * Buttons participate in focus management but don't process text input. */ import { type Focusable } from "./focus.js"; export interface ButtonOptions { /** Called when button is pressed (Enter or Space) */ onPress?: () => void; /** * Custom keypress handler. * Return true to consume the key, false to let it bubble. * By default, Enter and Space trigger onPress. */ onKeypress?: (key: string) => boolean; } export interface Button extends Focusable { focused: () => boolean; focus: () => void; blur: () => void; dispose: () => void; handleKey: (key: string) => boolean; /** Programmatically press the button */ press: () => void; } /** * Create a button primitive with focus support. * * @example * ```tsx * const submitBtn = createButton({ * onPress: () => console.log('Submitted!'), * }); * * // Render * function SubmitButton() { * const isFocused = submitBtn.focused(); * return ( * * [ Submit ] * * ); * } * ``` */ export declare function createButton(options?: ButtonOptions): Button; //# sourceMappingURL=button.d.ts.map