콘텐츠로 이동
Page

Progress Stepper

여러 단계 흐름의 진행 상황을 간결하게 보여 줍니다.

  1. Account
  2. Profile
  3. Complete
import {
ProgressStepper,
ProgressStepperList,
ProgressStepperItem,
ProgressStepperMarker,
ProgressStepperLabel,
} from "@pelagornis/page/components";

위 미리보기는 이 파일을 렌더링한 것입니다. src/components/에 복사해서 시작하세요.

src/components/ProgressStepperExample.tsx
import { useState } from "react";
import {
ProgressStepper,
ProgressStepperItem,
ProgressStepperLabel,
ProgressStepperList,
ProgressStepperMarker,
} from "@pelagornis/page/components";
const steps = ["Account", "Profile", "Complete"];
export default function ProgressStepperDemo() {
const [step, setStep] = useState(2);
return (
<ProgressStepper value={step} onValueChange={setStep} className="w-full">
<ProgressStepperList>
{steps.map((label, index) => (
<ProgressStepperItem key={label} value={index + 1}>
<ProgressStepperMarker />
<ProgressStepperLabel>{label}</ProgressStepperLabel>
</ProgressStepperItem>
))}
</ProgressStepperList>
</ProgressStepper>
);
}

Progress Stepper 컴포넌트는 React 상태를 공유하는 여러 부분으로 이루어집니다. MDX에 적은 자식은 각각 별도의 아일랜드로 렌더링되어 부분끼리 서로 닿지 않습니다. 위 예제처럼 .tsx 파일에서 조합한 뒤 그 파일을 가져오세요.

src/content/docs/example.mdx
---
title: Example
---
import ProgressStepperExample from "../../components/ProgressStepperExample";
<ProgressStepperExample client:load />

client:load는 페이지를 불러올 때 아일랜드를 하이드레이션합니다. 페이지 아래쪽에 있는 콘텐츠에는 client:visible을 쓰세요.

Markdoc 태그는 Astro 컴포넌트를 렌더링하는데, 이 컴포넌트는 클라이언트 상태가 필요합니다. 예제를 하이드레이션하는 .astro 파일로 감싼 뒤, 그 파일을 태그로 등록하세요.

src/components/markdoc/ProgressStepperExample.astro
---
import ProgressStepperExample from "../ProgressStepperExample";
---
<ProgressStepperExample client:load />
markdoc.config.mjs
import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";
import starlightMarkdoc from "@astrojs/starlight-markdoc";
import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({
extends: [starlightMarkdoc(), pageMarkdoc()],
tags: {
"progress-stepper-example": {
render: component("./src/components/markdoc/ProgressStepperExample.astro"),
selfClosing: true,
},
},
});
src/content/docs/example.mdoc
{% progress-stepper-example /%}

컴포넌트를 이루는 부분과 각 부분이 렌더링하는 data-refineui 역할입니다.

부분역할
rootprogress-stepper
fillprogress-stepper-fill
itemprogress-stepper-item
labelprogress-stepper-label
listprogress-stepper-list
list_wrapprogress-stepper-list-wrap
markerprogress-stepper-marker
trackprogress-stepper-track

컴포넌트가 스타일을 적용하는 상태입니다. 컴포넌트 상태는 data 속성으로 드러납니다.

종류상태
data-statecomplete current upcoming