ValyroUI English version

Bottom Sheet

Нижняя шторка в стиле iOS: точки остановки, свайп, режим «подглядывания». Бесплатно, MIT · Окна и уведомления › Окна и панели

Установка

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

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

Пропсы

PropTypeDefault
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanfalseInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
snapPointsSnapPoint[]['50%', '92%']Heights the sheet rests at, lowest first: px (320 or '320px') or a share of the available height ('50%'). Default ['50%', '92%'] — iOS medium and large detents.
snapnumberIndex of the current snap point (controlled).
defaultSnapnumber0Snap point the sheet opens at (default 0, the lowest).
onSnapChange(index: number) => voidCalled with the new snap when it changes.
modalbooleantruetrue (default): backdrop, focus trap, page scroll lock. false: a "peek" sheet that leaves the page interactive, like the drawer of a maps app.
dismissiblebooleantrueCan be closed by dragging below the lowest snap point, Escape or a backdrop press (default true).
dimFromnumber0Snap index at which the backdrop is fully dimmed; it fades in below that (default 0).
titleReactNodeHeading in the draggable header; also the dialog's accessible name.
descriptionReactNodeText under the title; also the dialog's accessible description.
showHandlebooleantrueShow the grab handle (default true).
containerHTMLElement | nullRender inside this element (which should be position: relative; overflow: hidden) instead of over the viewport — for sheets inside a panel, map or device frame.
initialFocusRefRefObject<HTMLElement | null>Element focused when a modal sheet opens (default: the sheet itself).
labelsPartial<BottomSheetLabels>Overrides for the built-in English text; keys left out keep their defaults.
childrenReactNodeSheet body; it scrolls only at the highest snap point, otherwise dragging it moves the sheet. In the compound form, a BottomSheet.Trigger and a BottomSheet.Content (with .Header, .Title, .Description, .Body, .Close).

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

BottomSheet.Trigger (BottomSheetTrigger), BottomSheet.Content (BottomSheetContent), BottomSheet.Header (BottomSheetHeader), BottomSheet.Title (BottomSheetTitle), BottomSheet.Description (BottomSheetDescription), BottomSheet.Body (BottomSheetBody), BottomSheet.Close (BottomSheetClose)

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

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

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