Catalogo design-system primitive

← catalogo / primitive

Catalyst · Link

CL-PR-15 Catalyst

catalyst/link

Anteprima disegnata disponibile solo per la versione html: questa e' typescript, sotto c'e' il sorgente.

Pacchetti da installare

@headlessui/reactreact

Sorgente (typescript)

/**
 * TODO: Update this component to use your client-side framework's link
 * component. We've provided examples of how to do this for Next.js, Remix, and
 * Inertia.js in the Catalyst documentation:
 *
 * https://catalyst.tailwindui.com/docs#client-side-router-integration
 */

import * as Headless from '@headlessui/react'
import React, { forwardRef } from 'react'

export const Link = forwardRef(function Link(
  props: { href: string } & React.ComponentPropsWithoutRef<'a'>,
  ref: React.ForwardedRef<HTMLAnchorElement>
) {
  return (
    <Headless.DataInteractive>
      <a {...props} ref={ref} />
    </Headless.DataInteractive>
  )
})