Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Navigation

MobileStepper

Compact stepper for phones and carousels: Back · dots · Next.

import { MobileStepper } from "@stylhero/ui";

Example

Code
import { useState } from "react";
import { Button, MobileStepper } from "@stylhero/ui";

function MobileStepperExample() {
  const [step, setStep] = useState(0);
  return (
    <MobileStepper steps={5} active={step}
      back={<Button size="sm" variant="ghost" disabled={step === 0} onClick={() => setStep(step - 1)}>Back</Button>}
      next={<Button size="sm" variant="ghost" disabled={step === 4} onClick={() => setStep(step + 1)}>Next</Button>} />
  );
}

Props

PropTypeDefaultDescription
active required number -
steps required number - Number of steps.
back ReactNode - Usually a Back button.
next ReactNode - Usually a Next button.
variant "dots" | "text" | "progress" "dots" "dots" for a few steps, "text" ("2 / 5"), or "progress" for a bar.

Also takes every <div> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.

Accessibility

  • The dots are an image labelled "Step 2 of 5"; the progress variant is a role="progressbar".

Generated from src/components/Stepper.tsx. Something wrong or missing? Open an issue.