Button

Buttons help our travellers make all kinds of action, from logging in to booking that dream trip.

 

Primary

The Backpack primary button is available in two sizes and comes with styles for hover, active and disabled states.

Storybook failed to load.

Primary on Dark

This button can be used on dark coloured backgrounds.

Storybook failed to load.

Primary on Light

This button can be used on light coloured backgrounds.

Storybook failed to load.

Secondary

Similar to the primary button, the secondary version is available in two sizes and comes with styles for hover, active and disabled states.

Storybook failed to load.

Secondary on Dark

This button can be used on dark coloured backgrounds.

Storybook failed to load.

This button is reserved for featured actions.

Storybook failed to load.

Destructive

This button can be used to highlight destructive actions.

Storybook failed to load.

As links, Link buttons are used as a tertiary means of triggering actions. The styling of Link buttons is different from links due to the vertical padding applied to Link buttons. Like all other buttons, these are available in two sizes and have hover, active and disabled states.

Storybook failed to load.

This button can be used on light coloured backgrounds.

Storybook failed to load.

Loading Buttons

Storybook failed to load.

bpk-component-button

Backpack button component.

Installation

Check the main Readme for a complete installation guide.

Usage


                                                
                                                import { withButtonAlignment, withRtlSupport } from '@skyscanner/backpack-web/bpk-component-icon';
                                                import ArrowIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/long-arrow-right';
                                                import { BpkButtonV2, BUTTON_TYPES, SIZE_TYPES } from '@skyscanner/backpack-web/bpk-component-button';
                                                
                                                const AlignedArrowIcon = withButtonAlignment(withRtlSupport(ArrowIcon));
                                                
                                                export default () => (
                                                  <div>
                                                    <BpkButton>Primary</BpkButton>
                                                    <BpkButton size={SIZE_TYPES.large}>Large primary</BpkButton>
                                                    <BpkButton type={BUTTON_TYPES.secondary}>Secondary</BpkButton>
                                                    <BpkButton type={BUTTON_TYPES.secondaryOnDark}>SecondaryOnDark</BpkButton>
                                                    <BpkButton type={BUTTON_TYPES.link}>Link</BpkButton>
                                                    <BpkButton type={BUTTON_TYPES.linkOnDark}>LinkOnDark</BpkButton>
                                                    <BpkButton type={BUTTON_TYPES.primaryOnDark}>PrimaryOnDark</BpkButton>
                                                    <BpkButton type={BUTTON_TYPES.primaryOnLight}>PrimaryOnLight</BpkButton>
                                                    <BpkButton iconOnly>
                                                      <AlignedArrowIcon />
                                                      <span className="visually-hidden">Search</span>
                                                    </BpkButton>
                                                  </div>
                                                );

Props

Property PropType Required Default Value
children - true -
type oneOf(BUTTON_TYPES) false BUTTON_TYPES.primary
size oneOf(SIZE_TYPES) false SIZE_TYPES.small
className string false null
disabled bool false false
iconOnly bool false false
onClick func false null
rel string false null
submit bool false false
href string false null
blank bool false false

bpk-component-loading-button

Backpack loading button component.

Installation

Check the main Readme for a complete installation guide.

Usage


                                                
                                                import BpkLoadingButton from '@skyscanner/backpack-web/bpk-component-loading-button';
                                                import BaggageIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/baggage';
                                                import { withButtonAlignment, withRtlSupport } from '@skyscanner/backpack-web/bpk-component-icon';
                                                
                                                const AlignedBaggageIcon = withButtonAlignment(withRtlSupport(BaggageIcon));
                                                const icon = <AlignedBaggageIcon />;
                                                
                                                export default () => (
                                                  <div>
                                                    <BpkLoadingButton>Primary</BpkLoadingButton>
                                                    <BpkLoadingButton large>Large primary</BpkLoadingButton>
                                                    <BpkLoadingButton secondary>Secondary</BpkLoadingButton>
                                                    <BpkLoadingButton iconOnly>
                                                      <span className="visually-hidden">Search</span>
                                                    </BpkLoadingButton>
                                                    <BpkLoadingButton icon={icon} iconDisabled={icon}>Custom Icon</BpkLoadingButton>
                                                  </div>
                                                );

Props

Property PropType Required Default Value
children node true -
className string false null
disabled bool false false
secondary bool false false
destructive bool false false
loading bool false false
iconOnly bool false false
icon element false null
iconDisabled element false null
iconPosition oneOf(ICON_POSITION) false ICON_POSITION.TRAILING