SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

RouteDialog

A dialog whose open state is the page's address.

View code
tsx
{url.searchParams.has("edit") ? (
	<RouteDialog id="edit-event" closeHref="/week" closeLabel="Close" aria-labelledby="edit-title">
		<form method="post" action="/events/42">
			<Dialog.Header>
				<Dialog.Title id="edit-title">Edit event</Dialog.Title>
			</Dialog.Header>
			<TextField label="Title" name="title" defaultValue="Design review" />
			<Dialog.Footer>
				<a href="/week">Cancel</a>
				<Button type="submit">Save</Button>
			</Dialog.Footer>
		</form>
	</RouteDialog>
) : null}

Demo apps

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { RouteDialog } from "@sdxc/ui/app";

Renders the dialog open, over a full-screen link back to the page without it. Without script the dialog sits fixed in the middle of the screen and the backdrop link closes it; with script it becomes modal, traps focus and closes on Escape.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
idstringYes
closeHrefstringYesThe page's address without the dialog, which closing it navigates to.
closeLabelstringYesThe close link's name, such as "Close".

Also accepts everything in Dialog.Props.

@sdxc/ui

Can’t find it? Contact us