Function
Dialog
({
trigger,
children,
}: {
trigger: ReactNode;
children: ReactNode;
})
Source from the content-addressed store, hash-verified
| 3 | import {ReactNode, useRef} from 'react'; |
| 4 | |
| 5 | export function Dialog({ |
| 6 | trigger, |
| 7 | children, |
| 8 | }: { |
| 9 | trigger: ReactNode; |
| 10 | children: ReactNode; |
| 11 | }) { |
| 12 | let ref = useRef<HTMLDialogElement | null>(null); |
| 13 | return ( |
| 14 | <> |
| 15 | <button onClick={() => ref.current?.showModal()}>{trigger}</button> |
| 16 | <dialog ref={ref} onSubmit={() => ref.current?.close()}> |
| 17 | {children} |
| 18 | </dialog> |
| 19 | </> |
| 20 | ); |
| 21 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected