ValyroUI English version

Dialog

Модальные окна. Бесплатно, MIT · Окна и уведомления › Окна и панели

Установка

npx valyro-cli@latest add dialog
npx shadcn@latest add https://valyro.xyz/r/dialog.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { Dialog } from 'valyro-ui';

Пропсы

PropTypeDefault
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanfalseInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
titleReactNodeHeading; becomes the dialog's accessible name.
descriptionReactNodeSupporting text; becomes the dialog's accessible description.
footerReactNodeAction bar under the body, usually buttons.
size'sm' | 'md' | 'lg' | 'full''md'On phones (≤ 480px) every size becomes a bottom sheet, except small Glass dialogs, which stay iOS alerts.
showClosebooleantrueShow the × button (default true).
closeLabelstring'Close'Accessible name of the × button.
childrenReactNodeBody content; it scrolls between the header and the footer when it overflows. In the compound form, a Dialog.Trigger and a Dialog.Content (with Dialog.Header, .Title, .Description, .Body, .Footer, .Close).
closeOnOverlayClickboolean
closeOnEscapeboolean
initialFocusRefRefObject<HTMLElement | null>
returnFocusRefRefObject<HTMLElement | null>Where focus goes on close when the element that opened the modal is no longer on the page (a deleted row's menu). Without it, focus moves to the first Tab stop near where that element was.
layerClassNamestringClass for the full-screen layer (positioning wrapper).
animation'default' | 'spring'spring: the panel springs in (centred panels drop in from from with a slight tilt, edge panels slide in critically damped). default: the theme's own enter and exit.
from'top' | 'bottom' | 'left' | 'right'Side a centred panel springs in from with animation="spring" (default top).

Составные части

Dialog.Trigger (DialogTrigger), Dialog.Content (DialogContent), Dialog.Header (DialogHeader), Dialog.Title (DialogTitle), Dialog.Description (DialogDescription), Dialog.Body (DialogBody), Dialog.Footer (DialogFooter), Dialog.Close (DialogClose)

Похожие компоненты

  • Confirm Dialog — Подтверждение действий
  • Drawer — Выдвижные панели
  • Bottom Sheet — Нижняя шторка в стиле iOS: точки остановки, свайп, режим «подглядывания»
  • Alert — Предупреждения
  • Toast — Всплывающие уведомления
  • Notification Center — Центр уведомлений
  • Loading Overlay — Экран загрузки
  • Popover — Всплывающий контент
  • Hover Card — Карточка при наведении
  • Tour — Онбординг-тур: подсветка элементов, шаги, прогресс и возобновление

Назад: Loading Overlay · Далее: Confirm Dialog · Весь раздел «Окна и уведомления»