React
LoadingonOpenChangeLoading React…
Open one. Five follow. Each tile runs Dialog in its own framework and reports the change in its own syntax.
Dialog docs: demo, examples and APIonOpenChangeLoading React…
@open-changeLoading Vue…
onOpenChangeLoading Svelte…
(openChange)Loading Angular…
onOpenChangeLoading Solid…
No changes yet. Use any tile.
The attributes on each framework's Popup element, read from the page while it is open. Open a tile to fill its column.
Each tile sets modal to false, so five popups can be open at once without each one shutting out the others.
The showcase example for Dialog, as written in each framework. Lines that only React has are marked.
import { Dialog } from '@▢▢▢▢/react/dialog'
export default function DialogExample() {
return (
<Dialog.Root>
<Dialog.Trigger className="button">
Open dialog
</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Backdrop className="backdrop" />
<Dialog.Popup className="dialog">
<Dialog.Title className="dialog-title">
Discard draft?
</Dialog.Title>
<Dialog.Description className="muted">
Your changes will be lost. This cannot be undone.
</Dialog.Description>
<div className="actions">
<Dialog.Close className="button">
Keep editing
</Dialog.Close>
<Dialog.Close className="button danger">
Discard
</Dialog.Close>
</div>
</Dialog.Popup>
</Dialog.Portal>
</Dialog.Root>
)
}
<script setup lang="ts">
import { Dialog } from '@▢▢▢▢/vue/dialog'
</script>
<template>
<Dialog.Root>
<Dialog.Trigger class="button">Open dialog</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Backdrop class="backdrop" />
<Dialog.Popup class="dialog">
<Dialog.Title class="dialog-title">Discard draft?</Dialog.Title>
<Dialog.Description class="muted">
Your changes will be lost. This cannot be undone.
</Dialog.Description>
<div class="actions">
<Dialog.Close class="button">Keep editing</Dialog.Close>
<Dialog.Close class="button danger">Discard</Dialog.Close>
</div>
</Dialog.Popup>
</Dialog.Portal>
</Dialog.Root>
</template>
Dialog in each framework, side by side. Lower is better for size, time and memory. No outside baseline: the frameworks are compared with each other only.
The Dialog.Root props as each framework writes them. A name that differs from React is marked.
onCheckedChange(checked, details), onOpenChange(open, details), onValueChange(value, details).:default-checked, :side-offset). Upstream's callbacks are Vue events with the same arguments: checkedChange(checked, details), openChange(open, details), valueChange(value, details).onCheckedChange(checked, details), onOpenChange(open, details), onValueChange(value, details), with details.cancel(), reason and event. Native event props use Svelte's names (onclick, onkeydown).checked, disabled, nativeButton); boolean inputs also work as bare attributes. Each callback with details is an output named without on: checkedChange, openChange, valueChange.onCheckedChange(checked, details), with details.cancel() and details.event. Native handlers are camelCase (onClick, onKeyDown), as Solid 2 requires.defaultOpenpropdefaultOpendefault-opendefaultOpen[defaultOpen]defaultOpenopenpropopenopenopen[open]openonOpenChangeeventonOpenChange@open-changeonOpenChange(openChange)onOpenChangeactionsRefpropactionsRefactions-refactionsRef[actionsRef]actionsRefdefaultTriggerIdpropdefaultTriggerIddefault-trigger-iddefaultTriggerId[defaultTriggerId]defaultTriggerIddisablePointerDismissalpropdisablePointerDismissaldisable-pointer-dismissaldisablePointerDismissal[disablePointerDismissal]disablePointerDismissalhandleprophandlehandlehandle[handle]handlemodalpropmodalmodalmodal[modal]modalonOpenChangeCompleteeventonOpenChangeComplete@open-change-completeonOpenChangeComplete(openChangeComplete)onOpenChangeCompletetriggerIdproptriggerIdtrigger-idtriggerId[triggerId]triggerIdchildrenpropchildren#defaultchildrenng-contentchildren