Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
ConfiguratorExamplesUsageAccessibilityAPI
Stepper Horizontal Framework Implementation Below you can find an interactive example of an outlined registration process.
Enter personal detailsConfirm e-mailSet passwordA form with personal details could be displayed here.Previous StepNext Step
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-stepper-horizontal>
  <p-stepper-horizontal-item state="current">Enter personal details</p-stepper-horizontal-item>
  <p-stepper-horizontal-item>Confirm e-mail</p-stepper-horizontal-item>
  <p-stepper-horizontal-item>Set password</p-stepper-horizontal-item>
</p-stepper-horizontal>

<div id="step-content-0">
  <p-text>A form with personal details could be displayed here.</p-text>
</div>
<div id="step-content-1" hidden>
  <p-text>A form with a verification code input field could be displayed here.</p-text>
</div>
<div id="step-content-2" hidden>
  <p-text>A form with a password input field could be displayed here.</p-text>
</div>

<p-button-group>
  <p-button type="button" id="prev-button" icon="arrow-head-left" variant="tertiary" disabled="true"
    >Previous Step</p-button
  >
  <p-button type="button" id="next-button" variant="primary">Next Step</p-button>
</p-button-group>
<script>
  const stepper = document.querySelector('p-stepper-horizontal');
  const stepElements = Array.from(document.querySelectorAll('p-stepper-horizontal-item'));
  const prevButton = document.querySelector('#prev-button');
  const nextButton = document.querySelector('#next-button');
  const panels = document.querySelectorAll('[id^="step-content"]');

  function getActiveStepIndex(steps) {
    return steps.findIndex((step) => step.state === 'current');
  }

  function manageContent(activeStepIndex) {
    if (activeStepIndex === 0) {
      prevButton.setAttribute('disabled', 'true');
    } else {
      prevButton.removeAttribute('disabled');
    }

    if (activeStepIndex === stepElements.length - 1) {
      nextButton.setAttribute('disabled', 'true');
    } else {
      nextButton.removeAttribute('disabled');
    }

    panels.forEach((panel, i) => {
      if (i === activeStepIndex) {
        panel.removeAttribute('hidden');
      } else {
        panel.setAttribute('hidden', '');
      }
    });
  }

  function onNextPrevStep(direction) {
    const activeStepIndex = getActiveStepIndex(stepElements);

    if (direction === 'next') {
      stepElements[activeStepIndex].state = 'complete';
      stepElements[activeStepIndex + 1].state = 'current';
      manageContent(activeStepIndex + 1);
    } else {
      stepElements[activeStepIndex].state = undefined;
      stepElements[activeStepIndex - 1].state = 'current';
      manageContent(activeStepIndex - 1);
    }
  }

  prevButton.addEventListener('click', () => onNextPrevStep('prev'));
  nextButton.addEventListener('click', () => onNextPrevStep('next'));

  stepper.addEventListener('update', (e) => {
    const { activeStepIndex } = e.detail;

    for (let i = activeStepIndex + 1; i < stepElements.length; i++) {
      // reset step state when going back via stepper horizontal item click
      stepElements[i].state = undefined;
    }
    stepElements[activeStepIndex].state = 'current';

    manageContent(activeStepIndex);
  });
</script>
</body>
</html>
Global settingsThemeChanges the theme of the application and any Porsche Design System component. It's possible to choose between forced theme light and dark. It's also possible to use auto, which applies light or dark theme depending on the operating system settings automatically.LightDarkAuto (sync with operating system)DirectionThe dir global attribute in HTML changes the direction of text and other content within an element. It's most often used on the <html> tag to set the entire page's direction, which is crucial for supporting languages that are written from right to left (RTL), such as Arabic and Hebrew. For example, using <html dir="rtl"> makes the entire page display from right to left, adjusting the layout and text flow accordingly.LTR (left-to-right)RTL (right-to-left)Text ZoomTo ensure accessibility and comply with WCAG 2.2 AA standards, it is mandatory for web content to support text resizing up to at least 200% without loss of content or functionality. Using relative units like rem is a best practice for achieving this, as they allow the text to scale uniformly based on the user's browser settings.100%130%150%200%