cel-tui
    Preparing search index...

    Interface ButtonProps

    Props for the Button component.

    Extends StyleProps — all style props (fgColor, bgColor, bold, italic, underline) are set on the container and inherited by the label text. This enables focusStyle to override them when the button is focused.

    interface ButtonProps {
        bgColor?: Color;
        bold?: boolean;
        fgColor?: Color;
        focusable?: boolean;
        focused?: boolean;
        focusStyle?: StyleProps;
        italic?: boolean;
        onBlur?: () => void;
        onClick: () => void;
        onFocus?: () => void;
        onKeyPress?: KeyPressHandler;
        padding?: { x?: number; y?: number };
        underline?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    bgColor?: Color

    Background color.

    bold?: boolean

    Render text with bold weight.

    fgColor?: Color

    Foreground (text) color.

    focusable?: boolean

    Whether the button participates in focus traversal.

    true
    
    focused?: boolean

    Whether this button is currently focused (controlled mode). When provided, the app owns focus state and must update it via onFocus/onBlur.

    focusStyle?: StyleProps

    Style overrides applied when focused. Overridden values participate in inheritance — the label text sees the focused styles as its defaults.

    italic?: boolean

    Render text in italic style.

    onBlur?: () => void

    Called when the button loses focus.

    onClick: () => void

    Called on mouse click or Enter when focused.

    onFocus?: () => void

    Called when the button receives focus.

    onKeyPress?: KeyPressHandler

    Key event handler. Receives normalized semantic keys that bubble up to this button. Return false to keep bubbling.

    padding?: { x?: number; y?: number }

    Internal padding in cells.

    underline?: boolean

    Render text with an underline.