mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
49 lines
1.1 KiB
Svelte
49 lines
1.1 KiB
Svelte
<script>
|
|
import {
|
|
ProgressIndicator,
|
|
ProgressStep,
|
|
Button,
|
|
} from "carbon-components-svelte";
|
|
|
|
let currentIndex = 1;
|
|
let thirdStepCurrent = false;
|
|
</script>
|
|
|
|
<ProgressIndicator bind:currentIndex>
|
|
<ProgressStep
|
|
complete
|
|
label="Step 1"
|
|
description="The progress indicator will listen for clicks on the steps"
|
|
/>
|
|
<ProgressStep
|
|
complete
|
|
label="Step 2"
|
|
description="The progress indicator will listen for clicks on the steps"
|
|
/>
|
|
<ProgressStep
|
|
complete
|
|
bind:current={thirdStepCurrent}
|
|
label="Step 3"
|
|
description="The progress indicator will listen for clicks on the steps"
|
|
/>
|
|
<ProgressStep
|
|
label="Step 4"
|
|
description="The progress indicator will listen for clicks on the steps"
|
|
/>
|
|
</ProgressIndicator>
|
|
|
|
<div style="margin: var(--cds-layout-02) 0">
|
|
<Button
|
|
kind={currentIndex === 2 ? "secondary" : "primary"}
|
|
on:click={() => {
|
|
currentIndex = currentIndex === 2 ? 0 : 2;
|
|
}}
|
|
>
|
|
Set currentIndex to
|
|
{currentIndex === 2 ? 0 : 2}
|
|
</Button>
|
|
</div>
|
|
|
|
<h3>Current index: {currentIndex}</h3>
|
|
|
|
<div>Is the third step currently selected? {thirdStepCurrent}</div>
|