Trilium Frontend API
    Preparing search index...

    Interface ModalProps

    interface ModalProps {
        bodyStyle?: CSSProperties;
        children: ComponentChildren;
        className: string;
        customTitleBarButtons?: CustomTitleBarButton[];
        footer?: ComponentChildren;
        footerAlignment?: "right" | "between";
        footerStyle?: CSSProperties;
        formRef?: RefObject<HTMLFormElement>;
        header?: ComponentChildren;
        helpPageId?: string;
        keepInDom?: boolean;
        maxWidth?: number;
        minWidth?: string;
        modalRef?: RefObject<HTMLDivElement>;
        noFocus?: boolean;
        onHidden: () => void;
        onShown?: () => void;
        onSubmit?: () => void;
        scrollable?: boolean;
        show: boolean;
        size: "xl" | "lg" | "md" | "sm";
        stackable?: boolean;
        title: ComponentChildren;
        zIndex?: number;
    }
    Index

    Properties

    bodyStyle?: CSSProperties
    className: string
    customTitleBarButtons?: CustomTitleBarButton[]
    footerAlignment?: "right" | "between"
    footerStyle?: CSSProperties
    formRef?: RefObject<HTMLFormElement>

    Gives access to the underlying form element of the modal. This is only set if onSubmit is provided.

    Items to display in the modal header, apart from the title itself which is handled separately.

    helpPageId?: string
    keepInDom?: boolean

    If true, the modal will remain in the DOM even when not shown. This can be useful for certain CSS transitions or when you want to avoid re-mounting the modal content.

    maxWidth?: number
    minWidth?: string

    Gives access to the underlying modal element. This is useful for manipulating the modal directly or for attaching event listeners.

    noFocus?: boolean

    If true, the modal will not focus itself after becoming visible.

    onHidden: () => void

    Called when the modal is hidden, either via close button, backdrop click or submit.

    Here it's generally a good idea to set show to false to reflect the actual state of the modal.

    onShown?: () => void

    Called when the modal is shown.

    onSubmit?: () => void

    If set, the modal body and footer will be wrapped in a form and the submit event will call this function. Especially useful for user input that can be submitted with Enter key.

    scrollable?: boolean

    If true, the modal body will be scrollable if the content overflows. This is useful for larger modals where you want to keep the header and footer visible while allowing the body content to scroll. Defaults to false.

    show: boolean

    Controls whether the modal is shown. Setting it to true will trigger the modal to be displayed to the user, whereas setting it to false will hide the modal. This method must generally be coupled with onHidden in order to detect when the modal was closed externally (e.g. by the user clicking on the backdrop or on the close button).

    size: "xl" | "lg" | "md" | "sm"
    stackable?: boolean

    By default displaying a modal will close all existing modals. Set this to true to keep the existing modals open instead. This is useful for confirmation modals.

    zIndex?: number