Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / More

OverlayFrame

A frame whose content fills it, with an overlay pinned at the bottom centre that stays put while the content scrolls under it: a "3 new" pill, a "jump to latest" button.

Default

When to useLink to "When to use"

ScrollArea and VirtualList already hold their scroller in an OverlayFrame and take an overlay prop: use those. Reach for OverlayFrame directly only to put the same overlay over a scroller of your own (a canvas, a code view).

Use something else when the content should move aside for the control (put it below the content in a Stack), or when it floats next to a selection (FloatingToolbar).

UsageLink to "Usage"

tsx
Copy
import { OverlayFrame } from "@arshad-shah/cynosure";

<OverlayFrame overlay={unseen > 0 && <Button onClick={jump}>{`${unseen} new`}</Button>}>
  <div style={{ overflow: "auto" }}>…</div>
</OverlayFrame>

PropsLink to "Props"

Every prop of OverlayFrame
PropWhat it doesTypeDefault
overlay
Content pinned over the frame at the bottom centre that does not scroll with what it covers: a "3 new" pill, a "jump to latest" button. Nothing (null, undefined or false): no overlay.ReactNode
children
What the overlay sits over: one element (a scroller) that fills the frame.ReactNode
className
Added to the root element, for layout.string
style
Layout only. Restyle through --cy-overlay-frame-* tokens.CSSProperties
data-testid
Set on the root element, for tests.string

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

Behaviour and accessibilityLink to "Behaviour and accessibility"

  • The content and the overlay share one grid cell: the content fills the frame and the overlay sits over its bottom centre, a little above the edge. Scrolling the content leaves it where it is.
  • The overlay is outside the content, so it is not part of a listbox or a named region it covers; give it a control with its own name.
  • It stacks above content raised with a z-index up to 2 (a sticky heading), so presses reach it.
  • null, undefined and false render no overlay. The frame itself stays, so the content is never remounted and keeps its scroll position.

ThemingLink to "Theming"

Tokens: --cy-overlay-frame-offset (space between the bottom edge and the overlay, default --cy-space-4) and --cy-overlay-frame-layer (the overlay's stacking order, default 3). Set them on the frame (a ScrollArea's root is one) or on any element around it.

ScrollArea and VirtualList render it for their overlay.

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog