<div class="demo-caption">A checkout</div>
<ray-card with-border radius="lg" padding="lg">
<ray-stepper id="demo-st-checkout" active="0" allow-step-select label="Checkout">
<ray-step label="Account" description="Who is buying">
<ray-grid cols="1 sm:2" gap="sm">
<ray-input label="Name" value="Ada Lovelace"></ray-input>
<ray-input label="Email" type="email" value="ada@ray.dev"></ray-input>
</ray-grid>
</ray-step>
<ray-step label="Shipping" description="Where it goes">
<ray-stack gap="sm">
<ray-input label="Address" placeholder="Street and number"></ray-input>
<ray-radio-group label="Delivery" orientation="horizontal" value="standard"><ray-radio value="standard">Standard · free</ray-radio><ray-radio value="express">Express · $9</ray-radio></ray-radio-group>
</ray-stack>
</ray-step>
<ray-step label="Payment" description="Card or invoice" id="demo-st-pay">
<ray-stack gap="sm">
<ray-segmented-control aria-label="Method" value="card"><option value="card">Card</option><option value="invoice">Invoice</option></ray-segmented-control>
<ray-input label="Card number" placeholder="4242 4242 4242 4242"></ray-input>
</ray-stack>
</ray-step>
<ray-step label="Review" description="Check and pay">
<dl class="demo-summary"><div><dt>2 × Pro seats</dt><dd>$2,499.00</dd></div><div class="total"><dt>Total</dt><dd>$2,499.00</dd></div></dl>
</ray-step>
<ray-center slot="completed" class="demo-st-done">
<ray-stack align="center" gap="xs"><span class="demo-center-icon"><ray-icon name="circle-check"></ray-icon></span><strong>Order placed</strong><span class="demo-muted">A receipt is on its way to ada@ray.dev.</span><ray-button size="xs" variant="default" id="demo-st-again">Start over</ray-button></ray-stack>
</ray-center>
</ray-stepper>
<ray-group slot="footer" justify="space-between" class="demo-st-nav">
<ray-button variant="default" size="sm" id="demo-st-back" disabled>Back</ray-button>
<ray-group gap="xs"><ray-switch label="Card declined" size="xs" id="demo-st-fail"></ray-switch><ray-button size="sm" id="demo-st-next">Next</ray-button></ray-group>
</ray-group>
</ray-card>
<div class="demo-caption">Vertical, with a step in progress</div>
<ray-stepper orientation="vertical" active="2" color="teal" label="Deploy">
<ray-step label="Build" description="4.1 s" icon="terminal"><p class="demo-muted">Compiled 42 modules.</p></ray-step>
<ray-step label="Test" description="128 passed" icon="circle-check"><p class="demo-muted">All tests passed.</p></ray-step>
<ray-step label="Upload" description="Uploading bundles…" loading><ray-progress value="64" size="sm" label="Upload"></ray-progress><p class="demo-muted">ray-remote-1.27.39-macos-arm64.dmg · 64%</p></ray-step>
<ray-step label="Release" description="Publish update.json" icon="download"><p class="demo-muted">Not started.</p></ray-step>
</ray-stepper>
<div class="demo-caption">Labels under the numbers, sizes, colors</div>
<ray-stack gap="xl">
<ray-stepper active="1" icon-position="top" size="sm" label="Onboarding"><ray-step label="Sign up"></ray-step><ray-step label="Profile"></ray-step><ray-step label="Team"></ray-step><ray-step label="Done"></ray-step></ray-stepper>
<ray-stepper active="2" size="lg" color="violet" label="Wizard"><ray-step label="One" icon="user"></ray-step><ray-step label="Two" icon="settings"></ray-step><ray-step label="Three" icon="bell"></ray-step></ray-stepper>
</ray-stack>
<script type="module">
const st = document.getElementById("demo-st-checkout");
const back = document.getElementById("demo-st-back");
const next = document.getElementById("demo-st-next");
const pay = document.getElementById("demo-st-pay");
const fail = document.getElementById("demo-st-fail");
const sync = () => {
const n = st.steps.length;
back.disabled = st.active === 0 || st.active >= n;
next.disabled = st.active >= n;
next.textContent = st.active === n - 1 ? "Place order" : "Next";
};
next.addEventListener("click", () => {
if (st.active === 2 && fail.checked) { pay.error = "Card declined: try another one."; return; }
pay.error = "";
st.next();
});
back.addEventListener("click", () => st.prev());
st.addEventListener("change", sync);
document.getElementById("demo-st-again").addEventListener("click", () => { st.active = 0; sync(); });
customElements.whenDefined("ray-stepper").then(sync);
</script>
import { RayCard, RayStepper, RayStep, RayGrid, RayInput, RayStack, RayRadioGroup, RayRadio, RaySegmentedControl, RayCenter, RayIcon, RayButton, RayGroup, RaySwitch, RayProgress } from "@raylang/react";
export function StepperExample() {
return (
<>
<div className="demo-caption">A checkout</div>
<RayCard withBorder radius="lg" padding="lg">
<RayStepper id="demo-st-checkout" active={0} allowStepSelect label="Checkout">
<RayStep label="Account" description="Who is buying">
<RayGrid cols="1 sm:2" gap="sm">
<RayInput label="Name" value="Ada Lovelace" />
<RayInput label="Email" type="email" value="ada@ray.dev" />
</RayGrid>
</RayStep>
<RayStep label="Shipping" description="Where it goes">
<RayStack gap="sm">
<RayInput label="Address" placeholder="Street and number" />
<RayRadioGroup label="Delivery" orientation="horizontal" value="standard"><RayRadio value="standard">Standard · free</RayRadio><RayRadio value="express">Express · $9</RayRadio></RayRadioGroup>
</RayStack>
</RayStep>
<RayStep label="Payment" description="Card or invoice" id="demo-st-pay">
<RayStack gap="sm">
<RaySegmentedControl aria-label="Method" value="card"><option value="card">Card</option><option value="invoice">Invoice</option></RaySegmentedControl>
<RayInput label="Card number" placeholder="4242 4242 4242 4242" />
</RayStack>
</RayStep>
<RayStep label="Review" description="Check and pay">
<dl className="demo-summary"><div><dt>2 × Pro seats</dt><dd>$2,499.00</dd></div><div className="total"><dt>Total</dt><dd>$2,499.00</dd></div></dl>
</RayStep>
<RayCenter slot="completed" className="demo-st-done">
<RayStack align="center" gap="xs"><span className="demo-center-icon"><RayIcon name="circle-check" /></span><strong>Order placed</strong><span className="demo-muted">A receipt is on its way to ada@ray.dev.</span><RayButton size="xs" variant="default" id="demo-st-again">Start over</RayButton></RayStack>
</RayCenter>
</RayStepper>
<RayGroup slot="footer" justify="space-between" className="demo-st-nav">
<RayButton variant="default" size="sm" id="demo-st-back" disabled>Back</RayButton>
<RayGroup gap="xs"><RaySwitch label="Card declined" size="xs" id="demo-st-fail" /><RayButton size="sm" id="demo-st-next">Next</RayButton></RayGroup>
</RayGroup>
</RayCard>
<div className="demo-caption">Vertical, with a step in progress</div>
<RayStepper orientation="vertical" active={2} color="teal" label="Deploy">
<RayStep label="Build" description="4.1 s" icon="terminal"><p className="demo-muted">Compiled 42 modules.</p></RayStep>
<RayStep label="Test" description="128 passed" icon="circle-check"><p className="demo-muted">All tests passed.</p></RayStep>
<RayStep label="Upload" description="Uploading bundles…" loading><RayProgress value={64} size="sm" label="Upload" /><p className="demo-muted">ray-remote-1.27.39-macos-arm64.dmg · 64%</p></RayStep>
<RayStep label="Release" description="Publish update.json" icon="download"><p className="demo-muted">Not started.</p></RayStep>
</RayStepper>
<div className="demo-caption">Labels under the numbers, sizes, colors</div>
<RayStack gap="xl">
<RayStepper active={1} iconPosition="top" size="sm" label="Onboarding"><RayStep label="Sign up" /><RayStep label="Profile" /><RayStep label="Team" /><RayStep label="Done" /></RayStepper>
<RayStepper active={2} size="lg" color="violet" label="Wizard"><RayStep label="One" icon="user" /><RayStep label="Two" icon="settings" /><RayStep label="Three" icon="bell" /></RayStepper>
</RayStack>
</>
);
}
<template>
<div class="demo-caption">A checkout</div>
<RayCard with-border radius="lg" padding="lg">
<RayStepper id="demo-st-checkout" :active="0" allow-step-select label="Checkout">
<RayStep label="Account" description="Who is buying">
<RayGrid cols="1 sm:2" gap="sm">
<RayInput label="Name" value="Ada Lovelace" />
<RayInput label="Email" type="email" value="ada@ray.dev" />
</RayGrid>
</RayStep>
<RayStep label="Shipping" description="Where it goes">
<RayStack gap="sm">
<RayInput label="Address" placeholder="Street and number" />
<RayRadioGroup label="Delivery" orientation="horizontal" value="standard"><RayRadio value="standard">Standard · free</RayRadio><RayRadio value="express">Express · $9</RayRadio></RayRadioGroup>
</RayStack>
</RayStep>
<RayStep label="Payment" description="Card or invoice" id="demo-st-pay">
<RayStack gap="sm">
<RaySegmentedControl aria-label="Method" value="card"><option value="card">Card</option><option value="invoice">Invoice</option></RaySegmentedControl>
<RayInput label="Card number" placeholder="4242 4242 4242 4242" />
</RayStack>
</RayStep>
<RayStep label="Review" description="Check and pay">
<dl class="demo-summary"><div><dt>2 × Pro seats</dt><dd>$2,499.00</dd></div><div class="total"><dt>Total</dt><dd>$2,499.00</dd></div></dl>
</RayStep>
<RayCenter slot="completed" class="demo-st-done">
<RayStack align="center" gap="xs"><span class="demo-center-icon"><RayIcon name="circle-check" /></span><strong>Order placed</strong><span class="demo-muted">A receipt is on its way to ada@ray.dev.</span><RayButton size="xs" variant="default" id="demo-st-again">Start over</RayButton></RayStack>
</RayCenter>
</RayStepper>
<RayGroup slot="footer" justify="space-between" class="demo-st-nav">
<RayButton variant="default" size="sm" id="demo-st-back" disabled>Back</RayButton>
<RayGroup gap="xs"><RaySwitch label="Card declined" size="xs" id="demo-st-fail" /><RayButton size="sm" id="demo-st-next">Next</RayButton></RayGroup>
</RayGroup>
</RayCard>
<div class="demo-caption">Vertical, with a step in progress</div>
<RayStepper orientation="vertical" :active="2" color="teal" label="Deploy">
<RayStep label="Build" description="4.1 s" icon="terminal"><p class="demo-muted">Compiled 42 modules.</p></RayStep>
<RayStep label="Test" description="128 passed" icon="circle-check"><p class="demo-muted">All tests passed.</p></RayStep>
<RayStep label="Upload" description="Uploading bundles…" loading><RayProgress :value="64" size="sm" label="Upload" /><p class="demo-muted">ray-remote-1.27.39-macos-arm64.dmg · 64%</p></RayStep>
<RayStep label="Release" description="Publish update.json" icon="download"><p class="demo-muted">Not started.</p></RayStep>
</RayStepper>
<div class="demo-caption">Labels under the numbers, sizes, colors</div>
<RayStack gap="xl">
<RayStepper :active="1" icon-position="top" size="sm" label="Onboarding"><RayStep label="Sign up" /><RayStep label="Profile" /><RayStep label="Team" /><RayStep label="Done" /></RayStepper>
<RayStepper :active="2" size="lg" color="violet" label="Wizard"><RayStep label="One" icon="user" /><RayStep label="Two" icon="settings" /><RayStep label="Three" icon="bell" /></RayStepper>
</RayStack>
</template>