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

@react-aria/link

Package Overview
Dependencies
Maintainers
2
Versions
833
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/link

Spectrum UI components in React

  • 3.0.0-nightly-326f48154-241213
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
868K
decreased by-7.01%
Maintainers
2
Weekly downloads
 
Created

What is @react-aria/link?

@react-aria/link is a package that provides accessible link components for React applications. It is part of the React Aria library, which offers a collection of hooks that implement accessible UI patterns.

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

Accessible Link

This feature allows you to create an accessible link component using the useLink hook. The hook provides the necessary props to ensure the link is accessible.

import { useLink } from '@react-aria/link';
import { useRef } from 'react';

function MyLink(props) {
  let ref = useRef();
  let { linkProps } = useLink(props, ref);

  return (
    <a {...linkProps} ref={ref}>
      {props.children}
    </a>
  );
}

Keyboard Navigation

This feature demonstrates how to use the useLink hook to create links that are navigable via keyboard, ensuring accessibility for users who rely on keyboard navigation.

import { useLink } from '@react-aria/link';
import { useRef } from 'react';

function MyLink(props) {
  let ref = useRef();
  let { linkProps } = useLink(props, ref);

  return (
    <a {...linkProps} ref={ref}>
      {props.children}
    </a>
  );
}

function App() {
  return (
    <div>
      <MyLink href="#">Home</MyLink>
      <MyLink href="#">About</MyLink>
      <MyLink href="#">Contact</MyLink>
    </div>
  );
}

Other packages similar to @react-aria/link

FAQs

Package last updated on 13 Dec 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