v1.1.10

Nav Link

Installation

Install yarn add @spark-web/nav-link
Source GitHub.com
Bundle unpkg.com

Nav links are styled links for use in site navigation.

Children

Valid children of a NavLink are a string, or a string plus an icon. No other combinations are allowed.

Border Radius

There are two valid border radii for a NavLink: 'small' and 'full'. Typically 'small' should be used for vertical navigations (like a sidebar) and 'full' should be used for horizontal navigations like in a header.

Hover or focus to see the different border radius options

isSelected

The isSelected prop is used to style the currently active page. It is important that it is only treated as active if the page is current as it also sets the aria-current attribute to page.

Size

NavLinks can be either medium or large.

Inline

By default, the underlying element will be display: flex and will take up all available space. By setting the inline prop to true the NavLink will be display: inline-flex instead.

Props

PropTypeDescription

children

NavLinkChildren: string | [ReactElement<IconProps, string | JSXElementConstructor<any>>, string] | [string, ReactElement<IconProps, string | JSXElementConstructor<any>>]

Children element(s) to be rendered inside the NavLink.

href

string

Returns the hyperlink's URL.

Can be set, to change the URL.

borderRadius?

"full" | "small"

Border radius of the NavLink.

Default: "small"

data?

DataAttributeMap

Sets data attributes on the component.

inline?

boolean

Indicates if NavLink should be inline or not.

Default: false

isSelected?

boolean

When true, add active styles to the NavLink and sets the aria-current attribute to page.

Default: false

size?

"medium" | "large"

Sets the size of the NavLink.

Default: "medium"

© 2023 Brighte Capital Pty Ltd