Horizontal navigation

A simple navigation component, ideal for representing a section of a page that links to other pages or views within the page.

Default

By default, navigation items are left aligned.

Storybook failed to load.

With disabled item

A navigation item can be disabled.

Storybook failed to load.

Space around

Navigation items can be configured to have space around them.

Storybook failed to load.

Not Underlined

The border that covers the bottom of the component can be hidden.

Storybook failed to load.

Light appearance

An alternate appearance is available for display over dark backgrounds.

Storybook failed to load.

bpk-component-horizontal-nav

Backpack horizontal nav component.

Installation

Check the main Readme for a complete installation guide.

Usage


                                                
                                                import { Component } from 'react';
                                                import BpkHorizontalNav, { BpkHorizontalNavItem } from '@skyscanner/backpack-web/bpk-component-horizontal-nav';
                                                
                                                export default class App extends Component {
                                                  constructor() {
                                                    super();
                                                    this.state = {
                                                      selected: 'flights',
                                                    };
                                                  }
                                                
                                                  onClick = (e) => {
                                                    this.setState({
                                                      selected: e.target.name,
                                                    });
                                                  }
                                                
                                                  render() {
                                                    return (
                                                      <BpkHorizontalNav>
                                                        <BpkHorizontalNavItem
                                                          name="flights"
                                                          selected={this.state.selected === 'flights'}
                                                          onClick={this.onClick}
                                                        >
                                                          Flights
                                                        </BpkHorizontalNavItem>
                                                        <BpkHorizontalNavItem
                                                          name="hotels"
                                                          selected={this.state.selected === 'hotels'}
                                                          onClick={this.onClick}
                                                        >
                                                          Hotels
                                                        </BpkHorizontalNavItem>
                                                        <BpkHorizontalNavItem
                                                          name="car-hire"
                                                          selected={this.state.selected === 'car-hire'}
                                                          onClick={this.onClick}
                                                        >
                                                          Car hire
                                                        </BpkHorizontalNavItem>
                                                      </BpkHorizontalNav>
                                                    );
                                                  }
                                                };

Props

Check out the full list of props on Skyscanner's design system documentation website.

Props

Storybook failed to load.