When to use
- A short task that needs values before it runs.
When not to
- Long forms: use a panel or a page.
Examples
Image size
import { useState } from 'react'
import { Button, Dialog, NumberField } from '@kition/tessera-ui'
export default function Demo() {
const [open, setOpen] = useState(false)
const [width, setWidth] = useState(1920)
return (
<>
<Button onClick={() => setOpen(true)}>Image size…</Button>
{open ? (
<Dialog
title="Image size"
onClose={() => setOpen(false)}
actions={
<>
<Button onClick={() => setOpen(false)}>Cancel</Button>
<Button variant="primary" onClick={() => setOpen(false)}>OK</Button>
</>
}
>
<NumberField label="Width" value={width} min={1} max={10000} unit="px" onChange={(value) => setWidth(value)} />
</Dialog>
) : null}
</>
)
}Props
Dialog
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | string | — | |
childrenrequired | ReactNode | — | |
actionsrequired | ReactNode | — | |
onCloserequired | () => void | — | |
onEscape | (event: KeyboardEvent) => void | — | Called for Escape in place of onClose (a dialog that lets a field keep its own Escape). |
modal | boolean | true | Blocks the page behind a backdrop (the default), where a press outside closes it. With
false the page stays usable: no backdrop, and the editor keeps its keys. |
uiId | string | — | |
testId | string | — | |
position | { x: number; y: number } | null | — | Where the dialog's top left sits in the window (with onMove); null or absent: where the layout puts it. |
onMove | (position: { x: number; y: number }) => void | — | Makes the dialog movable by its title: a drag moves it, and its place is reported once, on
release (keep it, and give it back as position). Absent, the title does not move it. |
Used in
8 of Kition's 16 kits use this component.
Board
Cube
Design
Film
Note
Photo
Slide
Vector