Nav Link
Installation
yarn add @spark-web/nav-link
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.
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
NavLink
s 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
Prop | Type | Description |
---|---|---|
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: |
data? | DataAttributeMap | Sets data attributes on the component. |
inline? | boolean | Indicates if NavLink should be inline or not. Default: |
isSelected? | boolean | When true, add active styles to the NavLink and sets the aria-current attribute to page. Default: |
size? | "medium" | "large" | Sets the size of the NavLink. Default: |