The as prop allows you to change the underlying HTML element while keeping the link's visual style. This is useful for semantic correctness when the link's behavior isn't standard navigation.
Element Mapping:
"a" (default): Navigation to other pages or external URLs."button": Actions that don't navigate (e.g., opening modals, triggering functions)."span": Non-interactive inline text with link styling (e.g., SEO, disabled states)."div": Non-interactive block-level content with link styling.
Note: When using as="button", as="span", or as="div", the component accepts props appropriate to that element type. For example, href is not valid for a button and will cause a TypeScript error.
import BpkLink from '@skyscanner/backpack-web/bpk-component-link';
// Rendering as a button (for actions without navigation)
<BpkLink as="button" onClick={() => {}}>
Trigger action
</BpkLink>
// Rendering as a span (non-interactive, for SEO or disabled states)
<BpkLink as="span">
Link styling without interaction
</BpkLink>
// Rendering as a div (block-level non-interactive element)
<BpkLink as="div">
Block-level link-styled text
</BpkLink>