View as Markdown

API reference: @salmonui/buttons/button

ToggleButtonBasePropsinterface

import type { ToggleButtonBaseProps } from '@salmonui/buttons/button';
interface ToggleButtonBaseProps extends Omit<ButtonBaseProps, 'value' | 'name'> {
    pressed?: boolean | undefined;
    defaultPressed?: boolean | undefined;
    onPressedChange?: ((pressed: boolean, event: ToggleChangeEvent) => void) | undefined;
    value?: string | undefined;
    name?: string | undefined;
}
ToggleButtonBaseProps members (23, 18 inherited)
NameSignatureDescription
pressedoptionalpressed?: boolean | undefined;

Controlled pressed state. Ignored inside a ToggleButtonGroup.

defaultPressedoptionaldefaultPressed?: boolean | undefined;

Initial pressed state when uncontrolled; restored on form reset. Default false.

onPressedChangeoptionalonPressedChange?: ((pressed: boolean, event: ToggleChangeEvent) => void) | undefined;

Proposed pressed state; called for controlled and uncontrolled buttons.

valueoptionalvalue?: string | undefined;

The item's value inside a ToggleButtonGroup (required there), and the submitted value of a standalone button with name (default "on").

nameoptionalname?: string | undefined;

Standalone form field name: a hidden input carries value while pressed.

childrenoptionalinheritedchildren?: ReactNode;
variantoptionalinheritedvariant?: ButtonVariant;

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

toneoptionalinheritedtone?: ButtonTone;

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

sizeoptionalinheritedsize?: ButtonSize;

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

iconStartoptionalinheritediconStart?: ReactNode;

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

iconEndoptionalinheritediconEnd?: ReactNode;

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

iconOnlyoptionalinheritediconOnly?: boolean;

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

loadingoptionalinheritedloading?: boolean;

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

loadingLabeloptionalinheritedloadingLabel?: string;

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

spinneroptionalinheritedspinner?: ReactNode;

Replaces the built-in spinner graphic.

progressoptionalinheritedprogress?: number;

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

progressLabeloptionalinheritedprogressLabel?: ((value: number) => string);

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

floatingoptionalinheritedfloating?: boolean | ButtonFloatingPosition;

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

floatingScopeoptionalinheritedfloatingScope?: "parent" | "viewport";

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

repeatoptionalinheritedrepeat?: boolean | ButtonRepeatOptions;

Press-and-hold repeat.

onRepeatoptionalinheritedonRepeat?: ((event: ButtonRepeatEvent) => void);

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

renderoptionalinheritedrender?: ((props: ButtonRenderProps) => ReactElement<unknown, string | JSXElementConstructor<any>>);

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

refoptionalinheritedref?: Ref<HTMLButtonElement>;

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