예제
설정 마법사
탭이 단계 표시기 역할을 하는 3단계 마법사입니다. 진행률 막대가 현재 위치를 나타내고, 각 패널 하단에 뒤로 및 계속 버튼이 있습니다.
미리보기
Europe
United States
Step 1 of 3
Skip this and invite people later from Settings.
Workspace
Acme Inc
Region
Europe
Invites
2 teammates
HTML
<bs:bsui-stack direction="column" gap="4" align="stretch">
<bs:bsui-progress value="2" max="3" label="Step 2 of 3" />
<bs:bsui-tabs defaultValue="team">
<bs:bsui-tabs-list>
<bs:bsui-tabs-trigger value="workspace" title="1. Workspace" />
<bs:bsui-tabs-trigger value="team" title="2. Team" />
<bs:bsui-tabs-trigger value="review" title="3. Review" />
</bs:bsui-tabs-list>
<bs:bsui-tabs-panel value="workspace">
<bs:bsui-stack direction="column" gap="4" align="stretch">
<bs:bsui-field>
<bs:bsui-field-label text="Workspace name" />
<bs:bsui-input name="workspace" defaultValue="Acme Inc" />
</bs:bsui-field>
<bs:bsui-field>
<bs:bsui-field-label text="Region" />
<bs:bsui-select name="wizard_region" defaultValue="eu" placeholder="Pick a region">
<bs:bsui-select-trigger />
<bs:bsui-select-popup>
<bs:bsui-select-option value="eu" label="Europe" />
<bs:bsui-select-option value="us" label="United States" />
</bs:bsui-select-popup>
</bs:bsui-select>
</bs:bsui-field>
<bs:bsui-stack direction="row" gap="2" align="center" justify="space-between">
<bs:bsui-text content="Step 1 of 3" variant="caption" tag="span" />
<bs:bsui-button label="Continue" variant="default" />
</bs:bsui-stack>
</bs:bsui-stack>
</bs:bsui-tabs-panel>
<bs:bsui-tabs-panel value="team">
<bs:bsui-stack direction="column" gap="4" align="stretch">
<bs:bsui-field>
<bs:bsui-field-label text="Invite teammates" />
<bs:bsui-textarea name="invites" rows="3" placeholder="One email per line" />
<bs:bsui-field-description text="Skip this and invite people later from Settings." />
</bs:bsui-field>
<bs:bsui-stack direction="row" gap="2" align="center" justify="space-between">
<bs:bsui-button label="Back" variant="outline" />
<bs:bsui-button label="Continue" variant="default" />
</bs:bsui-stack>
</bs:bsui-stack>
</bs:bsui-tabs-panel>
<bs:bsui-tabs-panel value="review">
<bs:bsui-stack direction="column" gap="3" align="stretch">
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="Workspace" variant="muted" tag="span" />
<bs:bsui-text content="Acme Inc" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="Region" variant="muted" tag="span" />
<bs:bsui-text content="Europe" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="Invites" variant="muted" tag="span" />
<bs:bsui-text content="2 teammates" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="2" align="center" justify="space-between">
<bs:bsui-button label="Back" variant="outline" />
<bs:bsui-button label="Create workspace" variant="default" />
</bs:bsui-stack>
</bs:bsui-stack>
</bs:bsui-tabs-panel>
</bs:bsui-tabs>
</bs:bsui-stack>작동 방식
탭 스토어가 활성 단계를 보관하고, 계속 및 뒤로 작업으로 단계를 이동하며, 진행률 값도 같은 컨텍스트에서 계산합니다. 단계 패널은 계속 마운트된 상태로 유지되어 뒤로 이동해도 입력한 값이 보존됩니다.
이 페이지의 모든 동작은 WordPress Interactivity API입니다. 각 컴포넌트가 자체 스토어를 등록하고, 서버 렌더링 컨텍스트에서 상태를 설정하며, 위 마크업의 디렉티브로 이벤트를 연결합니다. 페이지별 JavaScript는 없습니다.