Link Overlay

Makes a whole card clickable as one link, while links inside it still work on their own.

Usage

Code
import { LinkBox, LinkOverlay } from '@leverui/components';
Code
<LinkBox>
  <LinkOverlay />
</LinkBox>

The visible link text is the card's accessible name. Point the link at a real destination. The overlay does not make the card a button.

Other links inside the LinkBox sit above the overlay and stay clickable.

Examples

Article

Here's an example of using LinkOverlay to link an entire article.

Custom Link

Use the asChild prop to add support for a custom Link component like Solid Router's A. In Solid, asChild is a render function; spread getProps() onto your link so it keeps the overlay's behavior and styles.

Code
import { LinkBox, LinkOverlay } from '@leverui/components';
import { A } from '@solidjs/router';

function Example() {
  return (
    <LinkBox as="article">
      <h2>
        <LinkOverlay
          asChild={(getProps) => (
            <A {...getProps()} href="#">
              Blog Post Title
            </A>
          )}
        />
      </h2>
      <p>Some blog post content</p>
      <A href="#inner-link">Some inner link</A>
    </LinkBox>
  );
}

Caveat

People cannot select the content with a mouse or other pointing device.