View as Markdown

API reference: @salmonui/buttons/button

ButtonBasePropsinterface

import type { ButtonBaseProps } from '@salmonui/buttons/button';
interface ButtonBaseProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'> {
    children?: ReactNode;
    variant?: ButtonVariant | undefined;
    tone?: ButtonTone | undefined;
    size?: ButtonSize | undefined;
    iconStart?: ReactNode;
    iconEnd?: ReactNode;
    iconOnly?: boolean | undefined;
    loading?: boolean | undefined;
    loadingLabel?: string | undefined;
    spinner?: ReactNode;
    progress?: number | undefined;
    progressLabel?: ((value: number) => string) | undefined;
    floating?: boolean | ButtonFloatingPosition | undefined;
    floatingScope?: 'viewport' | 'parent' | undefined;
    repeat?: boolean | ButtonRepeatOptions | undefined;
    onRepeat?: ((event: ButtonRepeatEvent) => void) | undefined;
    render?: ((props: ButtonRenderProps) => ReactElement) | undefined;
    ref?: Ref<HTMLButtonElement> | undefined;
}
ButtonBaseProps members (18)
NameSignatureDescription
childrenoptionalchildren?: ReactNode;
variantoptionalvariant?: ButtonVariant | undefined;

Visual weight. Default 'solid' (or the group's).

toneoptionaltone?: ButtonTone | undefined;

Color role. Default 'neutral'; 'primary' for a floating button (or the group's).

sizeoptionalsize?: ButtonSize | undefined;

Metric set. Default 'md' (or the group's).

iconStartoptionaliconStart?: ReactNode;

Decorative icon before the label (inline-start; follows dir).

iconEndoptionaliconEnd?: ReactNode;

Decorative icon after the label (inline-end; follows dir).

iconOnlyoptionaliconOnly?: boolean | undefined;

Square metrics for a button that shows only an icon; requires aria-label or aria-labelledby.

loadingoptionalloading?: boolean | undefined;

Shows a spinner, sets aria-busy and aria-disabled (focus is kept) and ignores activation.

loadingLabeloptionalloadingLabel?: string | undefined;

Visually hidden text appended to the name while loading. Default "Loading".

spinneroptionalspinner?: ReactNode;

Replaces the built-in spinner graphic.

progressoptionalprogress?: number | undefined;

Progress fill from inline-start, 0 to 100. No spinner unless loading.

progressLabeloptionalprogressLabel?: ((value: number) => string) | undefined;

Visually hidden progress text appended to the name. Default `${value}%`.

floatingoptionalfloating?: boolean | ButtonFloatingPosition | undefined;

Floating action button: circular, elevated, positioned by CSS.

floatingScopeoptionalfloatingScope?: 'viewport' | 'parent' | undefined;

'viewport' (default, position: fixed) or 'parent' (position: absolute in the nearest positioned ancestor).

repeatoptionalrepeat?: boolean | ButtonRepeatOptions | undefined;

Press-and-hold repeat.

onRepeatoptionalonRepeat?: ((event: ButtonRepeatEvent) => void) | undefined;

Each repeat while held; the first activation is the native onClick.

renderoptionalrender?: ((props: ButtonRenderProps) => ReactElement) | undefined;

Renders another element (a link, a router link) with the computed props.

refoptionalref?: Ref<HTMLButtonElement> | undefined;

The <button> (or the element render returns).