Interface OptionsNotificationOptions

Configuration for an options dialog.

interface OptionsNotificationOptions {
    cancelOption?: string;
    createOptionsButton?: ((option, props, isDefaultOption) => ReactNode);
    defaultOption?: string;
    description?: string;
    icon?: ReactNode;
    onOption?: ((option, isCancel, isDefault) => void);
    onValidateOption?: ((option?) => boolean | Promise<boolean>);
    options?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

cancelOption?: string

Allows for the cancel option to be specified. Allow for special styling.

Default Value

'Cancel'
createOptionsButton?: ((option, props, isDefaultOption) => ReactNode)

Hook for create custom options buttons

Type declaration

    • (option, props, isDefaultOption): ReactNode
    • Parameters

      • option: string
      • props: HTMLAttributes<HTMLButtonElement> & Attributes
      • isDefaultOption: boolean

      Returns ReactNode

Remarks

The option is passed as the children prop and as the second argument

defaultOption?: string

Allows for the option will be the default selected option and the enter key trigger.

Default Value

The first option
description?: string

Display text information for the user to make a decision.

icon?: ReactNode

Display an icon next to the description for additional context

Remarks

Not yet implemented

onOption?: ((option, isCancel, isDefault) => void)

Call when an option is selected.

Type declaration

    • (option, isCancel, isDefault): void
    • Parameters

      • option: string
      • isCancel: boolean
      • isDefault: boolean

      Returns void

Remarks

It is possible that the option can be both a cancel and a default option.

onValidateOption?: ((option?) => boolean | Promise<boolean>)

Call when an option is selected. If false is returned, the the dialog will not close. Notification is not provided but can be supplied via the textFieldProps helperText property.

Type declaration

    • (option?): boolean | Promise<boolean>
    • Parameters

      • Optional option: string

      Returns boolean | Promise<boolean>

options?: string[]

The options as a list of strings

title?: string

The title of the options panel