Navigation
This component is displayed as a sidebar and it contains two sections: "global" and "container". Both sections are used for navigating through different views and containers in a product.
Although the ak-navigation component can be used by itself, it works best in conjunction with the ak-page component.
Try it out
Interact with a live demo of the ak-navigation component.
Although the ak-navigation component can be used by itself, it works best in conjunction with the ak-page component.
Installation
npm install ak-navigation
Using the component
HTML
The ak-navigation
package exports the AkNavigation Skate component.
Import the component in your JS resource:
bundle.js
;
Now you can use the defined tag in your HTML markup:
index.html
<!-- ... --> <!-- Slots for global actions --> <!-- Slots for global help / account --> Settings Log out AtlasKit is great Tell your friends <!-- Slots for search and create drawer content --> Search Create <!-- Default slot is the container --> Calendar Atlassian design Canvas
You can also use it from within another JavaScript resource:
; const component = ;documentbody;
React
This is a standard web component, if you want to use it in your React app, use the Skate.js React integration.
;; const ReactComponent = ; ReactDOM;
Classes
NavigationLink
Kind: global class
Emits: Navigation#event:linkSelected
-
Properties
navigationLink.href
:string
navigationLink.selected
:boolean
-
Events
new NavigationLink()
Create instances of the component programmatically, or using markup.
HTML Example
<ak-navigation-link> <ak-icon gylph="bitbucket" slot="icon"/> Bitbucket</ak-navigation-link>
navigationLink.href
: string
The link that the NavigationLink references.
Kind: instance property of NavigationLink
JS Example
navigationLinkhref = 'http://example.com';
HTML Example
<ak-navigation-link href="http://example.com"/>;
navigationLink.selected
: boolean
Whether the navigation is currently selected,
which is true
if the user has clicked on the link.
This will be set to true
on selection, and set to false
when other NavigationLink in the same navigation becomes selected.
Kind: instance property of NavigationLink
JS Example
navigationLinkselected = true;
HTML Example
<ak-navigation-link selected/>;
"linkSelected"
This event gets emitted before a link is selected
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onLinkSelected= console></ak-navigation>
JS Example
; navigation;
"createDrawerSelected"
This event gets emitted before a create drawer is selected (either opening or closing it)
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onCreateDrawerSelected= console></ak-navigation>
JS Example
; navigation;
"searchDrawerSelected"
This event gets emitted before a search drawer is selected (either opening or closing it)
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onSearchDrawerSelected= console></ak-tag>
JS Example
; navigation;
"open"
This event gets emitted before the navigation.open
is set to true
.
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onOpen= console></ak-navigation>
JS Example
; navigation;
"close"
This event gets emitted before the navigation.open
is set to false
.
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onClose= console></ak-navigation>
JS Example
; navigation;
"widthChanged"
This event gets emitted after the width of the navigation changes.
Note that this will also be emitted one time at the start,
with e.detail.oldWidth
set to null
.
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onWidthChanged= console></ak-navigation>
JS Example
; navigation;
"resizeStart"
This event gets emitted when a user begins resizing the navigation by dragging with mouse.
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onResizeStart= console></ak-navigation>
JS Example
; navigation;
"widthChanged"
This event gets emitted after the width of the navigation changes.
Note that this will also be emitted one time at the start,
with e.detail.oldWidth
set to null
.
Kind: event emitted by NavigationLink
HTML Example
<ak-navigation onWidthChanged= console></ak-navigation>
JS Example
; navigation;
Navigation
Kind: global class
Emits: Navigation#event:createDrawerSelected
, Navigation#event:searchDrawerSelected
, Navigation#event:open
, Navigation#event:close
, Navigation#event:widthChanged
, Navigation#event:resizeStart
, Navigation#event:resizeEnd
-
Properties
navigation.shouldAnimate
:boolean
navigation.width
:integer
navigation.toggleHandler
:function
navigation.open
:boolean
navigation.containerName
:string
navigation.containerLogo
:string
navigation.containerHref
:string
navigation.productLogo
:string
navigation.productHref
:boolean
navigation.containerHidden
:boolean
navigation.collapsible
:string
navigation.searchDrawerOpen
:string
navigation.createDrawerOpen
:string
new Navigation()
Create instances of the component programmatically, or using markup.
HTML Example
<ak-navigation open collapsible />
JS Example
; const navigation = ;documentbody;
navigation.shouldAnimate
: boolean
Whether the component should display animations.
shouldAnimate
is turned on after page load.
Kind: instance property of Navigation
JS Example
navigationshouldAnimate = true;
navigation.width
: integer
The current width of the navigation component, in pixels
Kind: instance property of Navigation
JS Example
navigationwidth = 80;
HTML Example
<ak-navigation width="80"/>;
navigation.toggleHandler
: function
The handler for the sidebar toggling behaviour. The handler is bound on attach, and unbound on detach.
Kind: instance property of Navigation
JS Example
navigation {};
navigation.open
: boolean
Whether the sidebar is in the open
state.
Note that setting this to false
will set both navigation.createDrawerOpen
and
navigation.searchDrawerOpen
to false
, and may recompute the navigation.width
.
Kind: instance property of Navigation
JS Example
navigationopen = false;
HTML Example
<ak-navigation open="false"/>;
navigation.containerName
: string
The name of the navigation container, displayed next to the container logo.
Kind: instance property of Navigation
JS Example
navigationcontainerName = 'Dashboard';
HTML Example
<ak-navigation container-name="Dashboard"/>;
navigation.containerLogo
: string
The logo for the navigation container, displayed next to the container name.
Kind: instance property of Navigation
JS Example
navigationcontainerLogo = 'http://example.com/img.jpg';
HTML Example
<ak-navigation container-logo="http://example.com/img.jpg"/>;
navigation.containerHref
: string
The link that the container name and logo will reference.
Kind: instance property of Navigation
JS Example
navigationcontainerHref = 'http://example.com';
HTML Example
<ak-navigation container-href="http://example.com"/>;
navigation.productLogo
: string
The name of the product glyph, to be placed in the global navigation. See the ak-icon#glyph docs for more details.
Kind: instance property of Navigation
JS Example
navigationproductLogo = 'bitbucket';
HTML Example
<ak-navigation product-logo="bitbucket"/>;
navigation.productHref
: boolean
The link that the product logo will reference
Kind: instance property of Navigation
JS Example
navigationproductHref = 'http://example.com';
HTML Example
<ak-navigation product-href="http://example.com"/>;
navigation.containerHidden
: boolean
Whether the navigation's container should be hidden at all times.
Note that this takes precedence over navigation.open
– regardless of whether
navigation.open
is true
, the container will be hidden.
Kind: instance property of Navigation
JS Example
navigationcontainerHidden = true;
HTML Example
<ak-navigation container-hidden/>;
navigation.collapsible
: string
Whether the navigation is collapsible by the user.
If navigation.collapsible === false
, it does not prevent direct
manipulation of navigation.open
.
Kind: instance property of Navigation
JS Example
navigationcollapsible = 'http://example.com';
HTML Example
<ak-navigation collapsible/>;
navigation.searchDrawerOpen
: string
Whether the search drawer is open.
Note that setting this to true
will set navigation.createDrawerOpen
to false
.
Kind: instance property of Navigation
JS Example
navigationsearchDrawerOpen = true;
HTML Example
<ak-navigation search-drawer-open/>;
navigation.createDrawerOpen
: string
Whether the create drawer is open.
Note that setting this to true
will set navigation.createDrawerOpen
to false
.
Kind: instance property of Navigation
JS Example
navigationcreateDrawerOpen = true;
HTML Example
<ak-navigation create-drawer-open/>;