Socket
Socket
Sign inDemoInstall

@react-aria/interactions

Package Overview
Dependencies
5
Maintainers
2
Versions
701
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @react-aria/interactions

Spectrum UI components in React


Version published
Weekly downloads
1.8M
increased by5.49%
Maintainers
2
Created
Weekly downloads
 

Package description

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

Readme

Source

@react-aria/interactions

This package is part of react-spectrum. See the repo for more details.

FAQs

Last updated on 22 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc