Skip to content
Gravity Logo / Docs Gravity home
Browse documentation
Documentation/Gravity Web

Link

The Link component routes a new view within the application router. It should be used instead of <a> to avoid reloading the page.

Usage

import { Link } from 'components/lib';

function MyComponent({ ...props }){
  return (
    <div>
      <Link url='/' title='Home' text='Go to Home' />
    </div>
  );
}

Props

PropDescriptionRequiredValue
childrenchildren to renderrequired if no text propcomponent(s)
classNamecustom styleoptionalSCSS or Tailwind
colorlink coloroptionalstring (dark/light), default: primary
textlink text requiredstring
titlelink title requiredstring
urldestination urlrequiredstring

Notes

  • The Link component uses the NavLink from react-router-dom for internal routing and <a> for external links.
  • The className prop allows for custom styling to be applied.
  • The color prop sets the link color and defaults to the primary color if not specified.
  • The text and title props provide the link text and title, respectively.
  • The url prop specifies the destination URL.