mithril-materialized
Version:
A materialize library for mithril.
44 lines (43 loc) • 1.49 kB
TypeScript
import { FactoryComponent, Vnode, Attributes } from 'mithril';
export interface ModalState {
isOpen: boolean;
id: string;
}
export interface ModalAttrs extends Attributes {
id?: string;
title: string;
description?: string | Vnode<any, any>;
/** Set to true when the description contains HTML */
richContent?: boolean;
/** Fixate the footer, so you can show more content. */
fixedFooter?: boolean;
/** Display on the bottom */
bottomSheet?: boolean;
/** Menu buttons, from left to right */
buttons?: Array<{
label: string;
iconName?: string;
disabled?: boolean;
onclick?: (e: UIEvent) => void;
className?: string;
}>;
/** Control modal visibility externally */
isOpen?: boolean;
/** Called when modal should be opened/closed */
onToggle?: (open: boolean) => void;
/** Called when modal is closed */
onClose?: () => void;
/** Show close button in top right (default true) */
showCloseButton?: boolean;
/** Close modal when clicking backdrop (default true) */
closeOnBackdropClick?: boolean;
/** Close modal when clicking a button (default false) */
closeOnButtonClick?: boolean;
/** Close modal when pressing escape key */
closeOnEsc?: boolean;
}
/**
* CSS-only Modal Panel component - no JavaScript dependencies
* Uses modern CSS techniques for modal functionality
*/
export declare const ModalPanel: FactoryComponent<ModalAttrs>;