Link

Behaviour

Usage

  • Use Link to navigate to another page or help topic; initiate a command; or choose an option.
  • Should render inline textual content only.
  • Should provide specific descriptive information about the result of clicking on the link.
  • Do NOT use when you just want to provide href to any non-textual component such as img or custom Component.
  • For aforementioned use case, use BaseButton with href and provide your custom styles to it however you'd like it to be.

Accessibility

  • Link (with or without href) is by accessible by keyboard.
  • Link should not have onClick listener when used with href.
  • Link will behave as a button without href.
  • Use title to provide more context if required.

Examples

Open BaseButton docs

LinkButton (without href)

API

NameTypeDefaultDescription
children
react node
Link's content.
className
string
Utility class names to be provided to Link
href
string
The URL that the hyperlink points to.

You can check the implementation of the component for more details.

You can import this module like so:

import {Link} from 'spaceweb/link'

It exports the following components or utility functions:

  • Link