ValyroUI English version

Scroll Area

Область прокрутки: свои полосы, мягкие края, прилипание к низу для чатов. Бесплатно, MIT · Навигация и каркас › Каркас

Установка

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

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

Пропсы

PropTypeDefault
childrenReactNodeContent, or the compound parts ScrollArea.Viewport (with ScrollArea.Content), .Scrollbar, .Corner and .ScrollButton.
orientation'vertical' | 'horizontal' | 'both''vertical'Axes that scroll. Default vertical.
scrollbars'overlay' | 'native' | 'hidden''overlay'overlay: the kit's thin bars over the content; native: the browser's bars in theme colours; hidden: none (wheel, touch and keys still scroll). Default overlay.
visibility'hover' | 'scroll' | 'auto' | 'always''hover'When overlay bars show: while the pointer is over the area, while scrolling, whenever it overflows, or always. Default hover.
hideDelaynumber600Ms before overlay bars hide after the pointer leaves or scrolling stops. Default 600.
edges'fade' | 'shadow' | 'none''fade'Hint at content hidden past an edge: a soft mask, an inset shadow, or nothing. Default fade.
edgeSizenumberDepth of the fade or shadow, px. Default --ui-scroll-area-edge-size (24px).
followbooleanKeep the end in view while content grows (chats, logs): any scroll back releases it, reaching the end picks it up again. Controlled: pair with onFollowChange. Passing this or defaultFollow turns follow mode on.
defaultFollowbooleanInitial follow when uncontrolled.
onFollowChange(follow: boolean) => voidCalled with the new follow when it changes.
thresholdnumber32Distance from the end, px, that counts as being at it. Default 32.
initialScroll'start' | 'end'Where it opens; end is applied before the first paint (no flash of the top). Default start, or end while following.
onEdgeReached(edge: ScrollAreaEdge) => voidCalled once each time an edge is reached (load more, older messages). start / end are the inline sides and mirror in RTL.
scrollButtonbooleanFloating "scroll to end" button while the end is out of view. Default: on in follow mode.
labelstringAccessible name of the scroll region, applied (with role="region") only while it overflows.
viewportRefRef<HTMLDivElement>Ref of the scrolling element (the root gets ref, className, style, data-* and aria-*).
viewportPropsComponentPropsWithRef<'div'>Props of the scrolling element.
labelsPartial<ScrollAreaLabels>Overrides for the built-in English text; keys left out keep their defaults.

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

ScrollArea.Viewport (ScrollAreaViewport), ScrollArea.Content (ScrollAreaContent), ScrollArea.Scrollbar (ScrollAreaScrollbar), ScrollArea.Thumb (ScrollAreaThumb), ScrollArea.Corner (ScrollAreaCorner), ScrollArea.ScrollButton (ScrollAreaScrollButton)

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

  • App Shell — Каркас приложения
  • Navbar — Верхняя навигация
  • Sidebar — Боковая панель
  • Resizable Panels — Панели с изменяемым размером
  • Breadcrumbs — Хлебные крошки
  • Tabs — Вкладки
  • Segmented Control — Переключатель режимов
  • Toggle Group — Кнопки-переключатели: форматирование, выравнивание, фильтры
  • Pagination — Постраничная навигация
  • Stepper — Пошаговые процессы
  • Dropdown Menu — Выпадающее меню
  • Context Menu — Контекстное меню

Назад: Resizable Panels · Далее: Breadcrumbs · Весь раздел «Навигация и каркас»