NV NVIDIA Elements Catalog Starters GitHub System Themes

Viewport

beta:  2.15.5 Coverage: 90.97% Bundle: 20.67kb Lighthouse: 100 Axe Core Released: 0.0.0
Overview API Examples

<nve-viewport>

Properties

PropertyAttributeDescriptionValues autoFit autoFit

Fits measurable direct default-slot content once after initial layout.

true
false
behaviorPan behavior-pan

Enables panning by pointer, focused wheel, focused keyboard, and Invoker commands; requires Space for primary-pointer dragging when set to space.

boolean
space
behaviorZoom behavior-zoom

Enables zooming by pinch, focused modified wheel, focused keyboard, and Invoker commands.

true
false
dragThreshold drag-threshold

CSS-pixel pointer movement required before a pointer pan begins.

number
fitInset fit-inset

Default uniform CSS-pixel inset reserved around bounds when fitting content.

number
maxScale max-scale

Inclusive upper scale limit.

number
minScale min-scale

Inclusive lower scale limit.

number
pannable none

Whether the viewport may admit new user-input panning.

true
false
scale scale

Content-to-viewport CSS-pixel scale.

number
x x

Horizontal content-space coordinate at the viewport origin.

number
y y

Vertical content-space coordinate at the viewport origin.

number
zoomable none

Whether the viewport may admit new user-input zooming.

true
false
zoomStops zoom-stops

Scale stops for keyboard and command zoom, clamped to the scale bounds. Defaults to built-in stops; an empty array uses only the bounds.

readonly number[]

Events

EventDescription capabilitieschange

Dispatched after pan or zoom availability or scale limits change.

viewportchange

Dispatched once after a render that commits one or more viewport transform changes.

viewportready

Dispatched when a rendered viewport connects or completes its first render while connected.

Slots

SlotDescription default

Content positioned in the viewport's infinite content space.

background

Custom content rendered behind viewport content and excluded from content fitting

overlay

Interactive content fixed above the transformed plane and excluded from content fitting

Invoker Commands

CommandDescription --pan-down

With behavior-pan enabled, pans down by one discrete step.

--pan-left

With behavior-pan enabled, pans left by one discrete step.

--pan-right

With behavior-pan enabled, pans right by one discrete step.

--pan-to

With behavior-pan enabled, moves to the source x and y content coordinates.

--pan-up

With behavior-pan enabled, pans up by one discrete step.

--zoom-in

With behavior-zoom enabled, animates to the next permitted scale step.

--zoom-out

With behavior-zoom enabled, animates to the previous permitted scale step.

--zoom-reset

With behavior-zoom enabled, animates to 100% scale.

--zoom-to

With behavior-zoom enabled, sets the centered scale from the source's numeric scale property.

--zoom-to-fit

With behavior-zoom enabled, animates to fit direct default-slot element boxes.

Methods

MethodSignaturesDescription animateTo
animateTo(target: Partial<ViewportTransform>, options?: ViewportAnimationOptions): void

Animates the viewport to the requested partial transform.

fitContents
fitContents(options?: ViewportRevealOptions): void

Fits the union of direct default-slot element boxes within the viewport.

getTransform
getTransform(): ViewportTransform

Returns the current content-space origin and CSS-pixel scale.

getVisibleRect
getVisibleRect(): ViewportRect

Returns the visible content-space rectangle.

reveal
reveal(region: { x: number; y: number; width?: number; height?: number }, options?: ViewportRevealOptions): void

Centers or fits a content-space region within the viewport.

toContentCoords
toContentCoords(viewportX: number, viewportY: number): ViewportPoint

Converts a viewport CSS-pixel point to content space.

toViewportCoords
toViewportCoords(contentX: number, contentY: number): ViewportPoint

Converts a content-space point to viewport CSS pixels.

CSS Properties

Css-propertyDescription --background

Background color of the fixed viewport area. MDN

--min-height --pan-cursor

Cursor shown over a background eligible for primary-pointer panning.

--panning-cursor

Cursor shown while a pointer pan is active.

Getting Started Getting Started Installation CLI MCP Skills Lint GitHub Integrations Getting Started Angular Bundles CDN Custom Elements Eleventy Golang HTMX + Go Hugo Import Maps Lit Lit Library MCP Apps NextJS Nuxt Pi Preact React SolidJS Sphinx Svelte TypeScript Vue About What’s New Changelog Metrics Support Accessibility Contributions Requests Migration Sitemap Foundations Overview Typography Iconography Themes Design Tokens Size & Space Objects Interactions Support Status Color Animation Fonts Layers Custom Layout Horizontal Vertical Grid Popovers i18n Visualization View Transitions DESIGN.md Elements Accordion Alert Avatar Badge Breadcrumb Button Button Group Card Chat Message Checkbox Codeblock Color Combobox Copy Button Datagrid Getting Started Integrations Column Action Column Alignment Column Fixed Column width Container Card Display Settings Footer Heatmap Keynav Multi Select Pagination Panel Detail Panel Grid Performance Placeholder Row Action Row Groups Row Sort Scroll Height Single Select Stripe Date Datetime Dialog Divider Dot Drag Handle Drawer Dropdown Dropdown Group Dropzone File Format Bytes Datetime Number Relative Time Truncate Forms Getting Started Validation Actions Control Gauge Icon Icon Button Input Input Group Logo Markdown Markdown CSS Media Controller Pause Button Playback Rate Select Loop Button Mute Button Media PiP Button Seek Button Time Range Volume Range Full-screen Button Menu Month Monaco Input Diff Input Monaco Editor Diff Editor Problems Notification Page Page Header Page Loader Pagination Progressive Filter Chip Progress Bar Progress Ring Password Preferences Input Pulse Radio Range Resize Handle Search Select Skeleton Sort Button Sparkline Star Rating Steps Switch Tabs Tag Textarea Time Toast Toggletip Toolbar Tooltip Tree Viewport Viewport Gridlines Minimap Zoom Range Week Patterns Agent Authentication Browse Chat Code Dashboard Editor Empty States Heatmap Keyboard Shortcut Logging Media Navigation Onboarding Panel Responsive Search Subheader Trend Labs Responsive Layout Viewport Container Patterns Forms API Design Properties & Attributes Slots Registration CustomEvents Stateless Composition Styles Packaging Glossary Logs Internal Guidelines Agent Harness Agent Tooling Agent Ownership Documentation Examples TypeScript Testing Unit Testing Accessibility Testing Lighthouse Testing SSR Testing Visual Testing Troubleshooting Component Creation Internal Examples All Examples