Skip to content

Navigation ​

These components help shoppers find their way around a shop. Use them for menus, trails, tabs, paging and step-by-step flows like checkout.

Shows where the current page sits in the shop, so a shopper can step back up a level.

vue
<script setup lang="ts">
import { Breadcrumb } from '@eldrajs/ui';

const trail = [
  { label: 'Home', href: '/' },
  { label: 'Women', href: '/women' },
  { label: 'Knitwear', href: '/women/knitwear' },
  { label: 'Sweaters', href: '/women/knitwear/sweaters' },
  { label: 'Lopi wool sweater' },
];
</script>

<template>
  <Breadcrumb :items="trail" :structured-data="false" />
</template>
PropDefaultWhat it does
itemsrequiredThe trail, starting at the home page. Each entry has a label and an href.
collapseAfter1How many levels stay visible at the start when the trail is shortened.
keepLast2How many levels stay visible at the end when the trail is shortened.
linkAs'a'Renders each link with your router's link component, such as RouterLink or NuxtLink.
structuredDatatrueAdds breadcrumb data for search engines.

TIP

The last item is always shown as the current page, never as a link. Leave its href out.

The shop's main menu. It shows dropdown panels on wide screens and a drawer on phones.

vue
<script setup lang="ts">
import { NavMenu } from '@eldrajs/ui';

const menu = [
  {
    label: 'Women',
    children: [
      { label: 'Sweaters', href: '/women/sweaters' },
      { label: 'Cardigans', href: '/women/cardigans' },
      { label: 'Hats and mittens', href: '/women/hats' },
    ],
  },
  {
    label: 'Men',
    children: [
      { label: 'Sweaters', href: '/men/sweaters' },
      { label: 'Scarves', href: '/men/scarves' },
    ],
  },
  { label: 'Journal', href: '/journal' },
  { label: 'Sale', href: '/sale', tone: 'accent' as const },
];
</script>

<template>
  <NavMenu :items="menu" aria-label="Main menu" />
</template>
PropDefaultWhat it does
itemsrequiredThe top-level entries. An entry with children or sections opens a panel.
collapseBelow'lg'The width below which the menu turns into a drawer button. 'never' keeps the bar.
variant'ghost'The look of the top-level links: 'ghost' or 'muted'.
openOnHoverfalseOpens panels when the pointer rests on an entry, not only on click.
linkAs'a'Renders each link with your router's link component.

TIP

Mark the page the shopper is on with current: true on its entry. Screen readers announce it.

Tabs, Tab and TabPanel ​

Splits related content into panels, such as a product's description, materials and shipping.

A relaxed crew neck sweater, hand knitted from Icelandic lopi wool.
Chest 96 cm, length 64 cm.
vue
<script setup lang="ts">
import { ref } from 'vue';
import { Tab, TabPanel, Tabs } from '@eldrajs/ui';

const productTab = ref('description');

const sizeTab = ref('s');
const sizeTabs = [
  { value: 's', title: 'S', content: 'Chest 96 cm, length 64 cm.' },
  { value: 'm', title: 'M', content: 'Chest 104 cm, length 67 cm.' },
  { value: 'l', title: 'L', content: 'Chest 112 cm, length 70 cm.' },
];
</script>

<template>
  <Tabs v-model="productTab" aria-label="Product information">
    <template #tabs>
      <Tab value="description">Description</Tab>
      <Tab value="materials">Materials and care</Tab>
      <Tab value="shipping">Shipping</Tab>
    </template>
    <TabPanel value="description"
      >A relaxed crew neck sweater, hand knitted from Icelandic lopi wool.</TabPanel
    >
    <TabPanel value="materials">100% Icelandic wool. Hand wash cold and dry flat.</TabPanel>
    <TabPanel value="shipping">Ships in 2 to 3 working days. Free returns within 30 days.</TabPanel>
  </Tabs>

  <Tabs v-model="sizeTab" variant="pills" aria-label="Sizes" :items="sizeTabs" />
</template>
PropDefaultWhat it does
ariaLabelrequiredNames the set of tabs for screen readers.
v-modelfirst tabThe value of the selected tab.
itemsnoneA quick way to build tabs from plain text: value, title and content.
variant'underline''underline' or 'pills'.
fillfalseStretches the tabs to share the full width.

Each Tab and its TabPanel share the same value. Put the Tabs in the tabs slot and the TabPanels in the default slot.

TIP

Use tabs for content a shopper reads one part at a time. If they need to compare parts, use an accordion or a plain page.

Accordion and AccordionItem ​

A list of sections that open and close, ideal for product details and FAQs.

How do I wash a wool sweater?
Hand wash in cold water with wool soap. Lay it flat to dry.
Will it shrink?Only with warm water
Not if you wash it cold. Warm water and tumble drying will shrink it.
Can I return it?
Yes, within 30 days, as long as it is unworn.
vue
<script setup lang="ts">
import { ref } from 'vue';
import { Accordion, AccordionItem } from '@eldrajs/ui';

const careOpen = ref(true);
</script>

<template>
  <Accordion>
    <AccordionItem v-model="careOpen" title="How do I wash a wool sweater?">
      Hand wash in cold water with wool soap. Lay it flat to dry.
    </AccordionItem>
    <AccordionItem title="Will it shrink?" help="Only with warm water">
      Not if you wash it cold. Warm water and tumble drying will shrink it.
    </AccordionItem>
    <AccordionItem title="Can I return it?">
      Yes, within 30 days, as long as it is unworn.
    </AccordionItem>
  </Accordion>
</template>
PropDefaultWhat it does
multiple (Accordion)trueLets several items stay open. Set false to close the others when one opens.
title (AccordionItem)requiredThe text on the item's header.
help (AccordionItem)noneA short line under the title.
v-model (AccordionItem)falseWhether the item is open.
headingLevel (AccordionItem)noneWraps the header in an h2, h3 or h4 to fit your page outline.

TIP

The content stays in the page while closed, so search engines and in-page search still find it.

Pagination ​

Lets shoppers move between pages of a long product list.

vue
<script setup lang="ts">
import { ref } from 'vue';
import { Pagination } from '@eldrajs/ui';

const page = ref(3);
</script>

<template>
  <Pagination v-model:page="page" :total-pages="12" />
  <Pagination v-model:page="page" :total-pages="12" compact />
</template>
PropDefaultWhat it does
pagerequiredThe current page, starting at 1. Use v-model:page to keep it in sync.
totalPagesrequiredHow many pages there are. Nothing shows when there is only one.
hrefForPagenoneBuilds a link for each page. Without it, the pages are buttons.
compactfalseAlways shows the short "Page 3 of 12" form.
siblings1How many page numbers show on each side of the current page.

TIP

Pass hrefForPage on a category page, for example (p) => '?page=' + p. Real links let search engines reach every page.

LoadMore ​

A button that adds the next batch of products below the list, with a count of how many are shown.

Showing 24 of 60 sweaters

vue
<script setup lang="ts">
import { ref } from 'vue';
import { LoadMore } from '@eldrajs/ui';

const shown = ref(24);
const loading = ref(false);

function loadMore() {
  loading.value = true;
  setTimeout(() => {
    shown.value = Math.min(shown.value + 24, 60);
    loading.value = false;
  }, 800);
}
</script>

<template>
  <LoadMore :shown="shown" :total="60" noun="sweaters" :pending="loading" @load="loadMore" />
</template>
PropDefaultWhat it does
shownrequiredHow many items are on the page now.
totalrequiredHow many items there are in all. The button hides when all are shown.
noun'products'The word in the count, as in "Showing 24 of 60 sweaters".
pendingfalseShows the button as busy while the next batch loads.

It emits load when the shopper clicks the button. Fetch the next batch there.

StepIndicator ​

Shows where a shopper is in a multi-step flow, such as checkout.

  1. Cart (completed)
  2. DeliveryPósturinn or pickup
  3. Payment (not started)
  4. Confirmation (not started)
  1. Cart (completed)
  2. Delivery (completed)Pósturinn or pickup
  3. Payment
  4. Confirmation (not started)
vue
<script setup lang="ts">
import { StepIndicator } from '@eldrajs/ui';

const checkoutSteps = [
  { label: 'Cart' },
  { label: 'Delivery', description: 'Pósturinn or pickup' },
  { label: 'Payment' },
  { label: 'Confirmation' },
];
</script>

<template>
  <StepIndicator :steps="checkoutSteps" :current="1" />
  <StepIndicator :steps="checkoutSteps" :current="2" orientation="vertical" />
</template>
PropDefaultWhat it does
stepsrequiredThe steps in order. Each has a label and an optional description.
currentrequiredThe current step, counting from 0. Steps before it show as done.
orientation'horizontal''horizontal' or 'vertical'. Vertical fits narrow screens best.

TIP

current counts from 0, so the second step is 1. Set it to the number of steps to mark them all done.

A row of slides a shopper can scroll through, such as bestsellers or a photo gallery.

Bestsellers

vue
<script setup lang="ts">
import { Carousel } from '@eldrajs/ui';

const bestsellers = [
  { name: 'Lopi wool sweater', price: '24.900 kr.', colour: '#c8d5c0' },
  { name: 'Merino beanie', price: '6.490 kr.', colour: '#e6d3bd' },
  { name: 'Wool mittens', price: '5.990 kr.', colour: '#cdd6e4' },
  { name: 'Knitted scarf', price: '9.900 kr.', colour: '#e2c6c6' },
  { name: 'Wool socks', price: '3.490 kr.', colour: '#d9d2e6' },
];
</script>

<template>
  <Carousel aria-label="Bestsellers" :per-view="{ base: 1.25, md: 3 }">
    <template #header>
      <h3 style="margin: 0">Bestsellers</h3>
    </template>
    <li v-for="item in bestsellers" :key="item.name" style="list-style: none">
      <div :style="{ background: item.colour, aspectRatio: '4 / 5', borderRadius: '8px' }"></div>
      <p style="margin: 8px 0 0; font-weight: 600">{{ item.name }}</p>
      <p style="margin: 0">{{ item.price }}</p>
    </li>
  </Carousel>
</template>
PropDefaultWhat it does
ariaLabelrequiredNames the carousel for screen readers.
perView1.25Slides visible at once. Pass { base, md, lg } to change it by width.
controls'header'Where the arrows sit: 'header' or 'below'.
dotsfalseShows one dot per slide. Use it only for one-slide-at-a-time galleries.
autoplay0Milliseconds between automatic moves. 0 turns it off.

Each direct child of the carousel is one slide.

TIP

Autoplay always shows a pause button, and it never starts for shoppers who ask for reduced motion.

Eldra