NVIDIA Elements Patterns Elements Foundations Integrations GitHub System Themes

Joystick

beta:  2.26.2 Coverage: 89.18% Bundle: 10kb Lighthouse: 100 Axe Core Released: 0.0.0
Overview API Examples

A joystick selects a normalized two-axis vector with pointer or keyboard input. Applications own physical units, coordinate frames, input shaping, publishing cadence, recording clocks, command-outcome feedback, and alternative controls when needed.

Give each joystick an accessible name with a label, aria-label, or aria-labelledby. Editable controls use the application role to receive two-axis keyboard input. The default accessible description includes both normalized coordinates, keyboard instructions, and release behavior. A locked axis stays at zero; an absent value reads "No position." Disabled and read-only controls omit instructions. Coordinates use up to six decimal places and the document language for number formatting. An explicit aria-description or aria-describedby replaces the default focus description through standard ARIA precedence; it does not disable live announcements.

Installation

CLI / MCP / CDN

Movement

Both axes use normalized values from -1 to 1. Applications can derive length with Math.hypot(x, y) and angle with Math.atan2(-y, x). This angle uses radians from the rightward direction with counterclockwise positive rotation. Use undefined at neutral. Keep these derived quantities outside the writable value. The angle does not describe the robot's heading.

Constraints

Constrains the movement region or selects one axis. Circle limits vector magnitude to one;square permits both axes at full scale and a magnitude of up to Math.SQRT2.With equally scaled planar velocity axes, square corners allow about 41% greater speed.Mixed forward-velocity and turning-rate axes have no common physical magnitude.Changing the constraint projects the current value silently and cancels an active interaction.

Constraint Description circle square horizontal vertical

Circle bounds normalized magnitude to one. Square allows independent full-scale axes and a magnitude of up to Math.SQRT2. Use circle for planar direction and intensity, or square for independent limits such as forward velocity and turning rate. Equally scaled planar velocity axes can produce about 41% greater diagonal speed with square input.

Size

Controls the visual scale of an element to match its importance and available space.

Size Description sm Compact size for dense layouts or secondary elements with less visual prominence. md Standard size that works well in most contexts and provides balanced visibility. lg Larger size for emphasizing important elements or improving touch targets in spacious layouts.

Choose small, medium, or large controls to fit the available space. Each size scales the movement surface and thumb together.

Opacity

Enables background transparency using the --opacity CSS custom property.

Opacity Description true false

Overlay a joystick with a translucent background on a checkered scene. Keep the border and thumb at full opacity for contrast.

Travel Turn

Input maps to ROS body axes: x-forward, y-left, z-up, with positive yaw counterclockwise. Travel uses square constraints for independent axis limits; use circle to bound normalized translation magnitude. The illustrative maxima are 1 m/s forward, 0.5 m/s lateral, and 1 rad/s yaw. Each control's :state(active) CSS custom state gates its displayed velocity. Interaction events refresh the readouts. The application chooses its limits and publishes the latest command at its own cadence, including while input remains stationary.

Released: x 0.00, y 0.00
Released: x 0.00, y 0.00
vx 0.00 m/s, vy 0.00 m/s, wz 0.00 rad/s

Input Shaping

A dead zone of zero and response exponent of one leave circular input unchanged. The dead zone makes neutral easier to select; a larger exponent provides finer control near neutral. The remaining range scales back to full output at the boundary and preserves direction. Shaping produces a separate command vector without rewriting .value. Map it to physical units afterward. Apply filtering in one input layer to avoid processing hardware or recorded samples twice. ROS joystick parameters

Dead zone 0.00, response 1.0 Raw: x 0.00, y 0.00 Shaped: x 0.00, y 0.00

Hold

Determines whether normal release returns to center or holds the final vector.Interrupted interactions return to neutral in either mode. Form reset restores the declared default instead.

Release Description center hold

Keep the last position after release for persistent target selection. Press Escape during an interaction to return to center.

Recorded Input

Set readOnly to true before assigning recorded vectors through .value. Use undefined for an absent sample and a zero vector for recorded neutral input. The recording layer captures source, sample time, engagement transitions, and mapping configuration. Preserve its clock during replay and avoid applying input shaping to recorded samples again.

Forms

Submit both axes as separate named fields and restore the declared position with form reset. Use held values when selecting persistent form targets.

Reset target

Accessibility

Controls automatic position announcements. Focused user input produces polite announcements at most every 500 ms.A quick tap in center mode reports the input coordinates and the return to center.Escape announces the resulting coordinates without a separate cancellation message.Programmatic writes and read-only playback update the description without live announcements.Set off when the application supplies spoken output, the position description on focus remains available.

Announce Description polite off

Supply application announcements with a labeled output. Disable built-in announcements to avoid duplicate feedback.

Target: X 0, Y 0

Internationalization

Enables updating internal string values for internationalization.

Override joystickPosition through i18n to localize spoken coordinates while keeping built-in position announcements.

Release Status

All elements and features go through 3 phases of stability, pre-release, beta and stable.

pre-release
Docs Preview API Documentation Fully Themeable
beta
Robust unit test coverages Passed API Review Passed Designer VQA Review Included in library package
stable
No known outstanding AA WCAG issues No known outstanding performance issues Adapts to different screen/container sizes No breaking API changes for at least 90 days
Getting Started Overview Installation CLI MCP Skills Lint What’s New GitHub Patterns Overview Agent Authentication Browse Chat Code Dashboard Editor Empty States Heatmap Keyboard Shortcut Logging Media Navigation Onboarding Panel Responsive Search Subheader Trend Elements Overview Accordion Alert Avatar Badge Breadcrumb Button Button Group Card Chat Message Checkbox Codeblock Color Combobox Copy Button Dashboard 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 Ghost Icon Icon Button Iframe Input Input Group Joystick List 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 Dot Progress Ring Password Preferences Input Pulse Radio Range Resize Handle Scroll Box Search Select Skeleton Sort Button Sparkline Star Rating Steps Switch Tabs Tag Text Textarea Time Toast Toggletip Toolbar Tooltip Tree Viewport Viewport Gridlines Minimap Zoom Range Virtual List Week Workspace 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 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 Changelog Metrics Support Accessibility Contributions Requests Migration Sitemap Labs Responsive Layout Viewport Container Patterns Forms Internal API Design Guidelines Properties & Attributes Slots Registration CustomEvents Stateless Composition Styles Packaging Glossary Logs Guidelines Agent Harness Agent Tooling Agent Ownership Documentation Examples TypeScript Testing Unit Testing Accessibility Testing Lighthouse Testing SSR Testing Visual Testing Troubleshooting Component Creation Examples All Examples