Interface HeadlessCheckboxProps

Props of the useCheckbox hook.

interface HeadlessCheckboxProps {
    id?: string;
    isAutofocused?: boolean;
    isChecked?: boolean;
    isDisabled?: boolean;
    isInvalid?: boolean;
    onBlur?: (() => void);
    onChange?: ((isChecked: boolean) => void);
    onFocus?: (() => void);
    onFocusChange?: ((isFocused: boolean) => void);
    onFocusVisible?: (() => void);
    onHoverChange?: ((isHovered: boolean) => void);
    onHoverEnd?: (() => void);
    onHoverStart?: (() => void);
}

Hierarchy (view full)

Properties

id?: string

An ID that uniquely identifies a checkbox.

isAutofocused?: boolean

If true then element is auto-focusable inside a focus scope.

false
isChecked?: boolean

If true then a checkbox is checked.

false
isDisabled?: boolean

If true then hover events are disabled.

false
isInvalid?: boolean

If true then a checkbox is marked as invalid.

false
onBlur?: (() => void)

A handler that is called when the element loses focus.

onChange?: ((isChecked: boolean) => void)

A handler that is called when a checkbox is checked or unchecked.

Type declaration

    • (isChecked): void
    • Parameters

      • isChecked: boolean

        true if checkbox is checked.

      Returns void

onFocus?: (() => void)

A handler that is called when the element receives focus.

onFocusChange?: ((isFocused: boolean) => void)

A handler that is called when the element's focus status changes.

Type declaration

    • (isFocused): void
    • Parameters

      • isFocused: boolean

        true if an element is focused.

      Returns void

onFocusVisible?: (() => void)

A handler that is called when the element receives focus that must be visible to a user.

onHoverChange?: ((isHovered: boolean) => void)

A handler that is called when the hover state changes.

Type declaration

    • (isHovered): void
    • Parameters

      • isHovered: boolean

        true if an element is hovered.

      Returns void

onHoverEnd?: (() => void)

A handler that is called when a hover interaction ends.

onHoverStart?: (() => void)

A handler that is called when a hover interaction starts.