Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/interactions

Package Overview
Dependencies
Maintainers
2
Versions
816
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/interactions

Spectrum UI components in React

  • 3.0.0-nightly.2897
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @react-aria/interactions?

The @react-aria/interactions package provides hooks and utilities to manage interactivity in React applications, focusing on accessibility and user interface behavior consistency across browsers and devices.

What are @react-aria/interactions's main functionalities?

usePress

Handles all aspects of press interactions across mouse, touch, and keyboard interactions, ensuring a consistent behavior.

import {usePress} from '@react-aria/interactions';
function MyButton(props) {
  let {pressProps} = usePress({
    onPress: () => console.log('Button pressed')
  });
  return <button {...pressProps}>Press me</button>;
}

useHover

Enables handling hover interactions, providing callbacks for hover start and end, which helps in managing hover states effectively.

import {useHover} from '@react-aria/interactions';
function MyComponent(props) {
  let {hoverProps, isHovered} = useHover({
    onHoverStart: () => console.log('Hover started'),
    onHoverEnd: () => console.log('Hover ended')
  });
  return <div {...hoverProps}>{isHovered ? 'Hovering' : 'Not hovering'}</div>;
}

useFocus

Manages focus events and states, providing a consistent and accessible experience across different input methods.

import {useFocus} from '@react-aria/interactions';
function MyInput(props) {
  let {focusProps} = useFocus({
    onFocusChange: isFocused => console.log(isFocused ? 'Focused' : 'Blurred')
  });
  return <input {...focusProps} placeholder='Focus on me' />;
}

Other packages similar to @react-aria/interactions

FAQs

Package last updated on 02 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc