Renders an <a href> link to the specified resource. The to prop is passed to navigateTo on click.
Props
Renders a CMS link.
Renders an <a href> link to the specified resource. The to prop is passed to navigateTo on click.
Props
to (Obj, Link, DataItem) – The CMS object, CMS link, or CMS data item to navigate to when clicking the link.to (String) – URL to navigate to. The URL needs to be a full URL, i.e., start with “https://”.params (Object) – Used to build the query part of the URL. The params are ignored if to is an external Link.onClick (Function) – Your event handler. This optional prop causes the specified function to be executed when the link is clicked. The function receives an event of the React.MouseEvent type. One can call preventDefault on the event to prevent the redirection.ref (React.Ref) – React’s ref object or callback. Provides access to the underlying DOM element, enabling low-level DOM interactions. Default: undefined.Remarks
a tag.a tag.DataItem to the to prop causes the link to navigate to the corresponding details page of the item.Examples
Render a navigation list comprised of all children of a page:
Pass params:
Pass an onClick property to call a method when the link is clicked:
Suppress the redirection using preventDefault: