Salesforce Lightning
JS behaviour
Path
The horizontal stage bar with marketing-colored chevrons and a Mark-Stage-Complete CTA — instantly reads as an opportunity on the move.
Real scenarios
The component as it is used in a product — not a specimen grid.
One click per stage
Mark Stage as Complete closes the current stage and fills its chevron; the escape hatch drops the deal to Closed Lost. Click any completed step to rewind.
Opportunity · Acme Industrial
Nabu annual license — renewal
Won — time to invoice
Deal fell through?
Reopen the deal:
Stage of 8 —
The four statuses
Complete takes its marketing colour, current adds the white edge, incomplete rests on grey, and the lost chevron turns red.
Qualification
complete
Needs Analysis
current
Value Proposition
incomplete
Closed Lost
lost
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| stage-status | enum | 'current' | complete shows a tick, current sits white on the stage colour, incomplete is grey and lost wears the palette’s red. |
| stage-color | color | '#0176D3' | Each stage takes a Marketing Cloud colour: blue, teal, purple, orange, pink, yellow, red and green. |
| mark-complete | event | 'click' | The always-visible Mark-Stage-Complete button closes the current stage and nudges the path one step forward. |
| coaching | field | null | A coaching field — the next step — sits under the current stage: the famous coaching path. |
Snippet
<div class="sflx-path" data-current="4">
<ol>
<li class="sflx-step" data-status="complete" style="--stage: #0176D3">Prospecting</li>
<li class="sflx-step" data-status="complete" style="--stage: #0B827C">Qualification</li>
<li class="sflx-step" data-status="current" style="--stage: #6739B7">Needs Analysis</li>
<li class="sflx-step" data-status="incomplete" style="--stage: #FE9339">Value Proposition</li>
</ol>
<button class="sflx-mark">Mark Stage as Complete</button>
</div>
<style>
.sflx-path ol { display: flex; }
.sflx-step { flex: 1; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%,
calc(100% - 12px) 100%, 0 100%, 12px 50%); padding: .5rem 1.5rem;
background: #E8E8E8; }
.sflx-step[data-status='complete'] { background: var(--stage); color: #fff; }
.sflx-step[data-status='current'] { background: var(--stage); color: #fff; font-weight: 700; }
.sflx-mark { margin: .5rem 0 0 auto; background: var(--stage); color: #fff; border-radius: .25rem; }
</style>
// resources/js/pages/Opportunities/Show.tsx — an Inertia page (React flavor).
// Inertia resolves this file for the /opportunities/{record} route and hands
// the record down as page props; the UI itself is the SalesPath component
// from the React snippet — no rewrite, just routing.
import SalesPath from '@/components/SalesPath';
export default function OpportunityShow() {
// A real page would read its data: const { opportunity } = usePage().props;
return <SalesPath />;
}
// SalesPath.tsx — the Lightning Path: marketing-coloured chevrons, the
// coaching "next step" field and the Mark-Stage-as-Complete CTA. The markup
// mirrors the playground partial (slp-* classes); styles ship with it.
import { type CSSProperties, useState } from 'react';
import '@nabuxai/ui-react/css';
const STAGES = [
{ label: 'Prospecting', color: '#0176D3' },
{ label: 'Qualification', color: '#0B827C' },
{ label: 'Needs Analysis', color: '#6739B7' },
{ label: 'Value Proposition', color: '#FE9339' },
{ label: 'Id. Decision Makers', color: '#B32D69' },
{ label: 'Proposal/Price Quote', color: '#FFB75D' },
{ label: 'Negotiation/Review', color: '#BA0517' },
{ label: 'Closed Won', color: '#04844B' },
];
const tint = (color: string) => ({ '--slp-stage': color }) as CSSProperties;
export default function SalesPath() {
// cur is the current stage; lost drops the whole deal to Closed Lost.
const [cur, setCur] = useState(5);
const [lost, setLost] = useState(false);
const status = (i: number) =>
lost ? (i < cur ? 'complete' : 'lost')
: i < cur ? 'complete' : i === cur ? 'current' : 'incomplete';
return (
<div className="slp-root">
<div className="slp-card">
<div className="slp-what">
<small>Opportunity · Bosporus Logistics (Istanbul)</small>
<b>Nabu annual license — renewal</b>
</div>
<ol className="slp-rail">
{STAGES.map((s, i) => (
<li key={s.label}>
<button type="button" className="slp-step" style={tint(s.color)}
data-status={status(i)}
aria-current={i === cur && !lost ? 'step' : undefined}
onClick={() => { if (i < cur && !lost) setCur(i); }}>
{s.label}
</button>
</li>
))}
</ol>
{!lost && (
<div className="slp-coach" style={tint(STAGES[cur].color)}>
<label htmlFor="slp-next">Next step</label>
<input id="slp-next" type="text" placeholder="e.g. send the revised quote" />
</div>
)}
<div className="slp-foot">
{!lost && cur < STAGES.length - 1 && (
<button type="button" className="slp-btn" data-variant="brand"
onClick={() => setCur(cur + 1)}>Mark Stage as Complete</button>
)}
{cur === STAGES.length - 1 && !lost && <span className="slp-won">✓ Won — time to invoice</span>}
{lost ? (
<span className="slp-flip">Reopen the deal:
<button type="button" className="slp-btn"
onClick={() => { setLost(false); setCur(5); }}>Back to Proposal</button>
</span>
) : (
<span className="slp-flip">Deal fell through?
<button type="button" className="slp-btn" data-variant="lost"
onClick={() => { setLost(true); setCur(STAGES.length - 2); }}>Mark as Lost</button>
</span>
)}
</div>
<p className="slp-hint">Stage {cur + 1} of {STAGES.length} — {STAGES[cur].label}</p>
</div>
<style>{css}</style>
</div>
);
}
const css = `
.slp-root { font-family: 'Salesforce Sans', -apple-system, 'Segoe UI', Roboto, sans-serif; color: #181818;
--slp-border: #DDDBDA; --slp-card: #FFFFFF; --slp-step-bg: #E8E8E8; --slp-step-ink: #3E3E3C;
--slp-blue: #0176D3; --slp-red: #BA0517; --slp-green: #04844B; --slp-muted: #706E6B; }
@media (prefers-color-scheme: dark) { .slp-root { color: #F3F3F3;
--slp-border: #474747; --slp-card: #232323; --slp-step-bg: #3B3B3B; --slp-step-ink: #D5D5D5;
--slp-blue: #0D9DDA; --slp-red: #FE5C4C; --slp-green: #0E9E5B; --slp-muted: #A5A5A5; } }
.slp-card { max-inline-size: 46rem; margin-inline: auto; padding: 1rem; border: 1px solid var(--slp-border);
border-radius: .25rem; background: var(--slp-card); display: grid; gap: 1rem; }
.slp-what { display: grid; gap: .15rem; }
.slp-what small { font-size: .78rem; color: var(--slp-muted); }
.slp-what b { font-size: 1.1rem; }
.slp-rail { display: flex; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.slp-rail li { display: contents; }
.slp-step { flex: 1; min-inline-size: 8.5rem; block-size: 2.6rem; padding-inline: 1.55rem; border: 0;
cursor: pointer; text-align: start; font-size: .78rem; font-weight: 600; line-height: 1.15;
background: var(--slp-step-bg); color: var(--slp-step-ink);
clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.slp-step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.slp-step[data-status='complete'], .slp-step[data-status='current'] { background: var(--slp-stage); color: #FFFFFF; }
.slp-step[data-status='current'] { font-weight: 700; }
.slp-step[data-status='lost'] { background: var(--slp-red); color: #FFFFFF; }
.slp-coach { display: grid; gap: .35rem; padding: .75rem; border: 1px solid var(--slp-border);
border-block-start: 2px solid var(--slp-stage); }
.slp-coach label { font-size: .72rem; font-weight: 700; color: var(--slp-muted); }
.slp-coach input { padding: .4rem .55rem; border: 1px solid var(--slp-border); border-radius: .25rem;
background: var(--slp-card); color: inherit; font: inherit; font-size: .85rem; }
.slp-foot { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.slp-btn { padding: .45rem 1rem; border: 1px solid var(--slp-border); border-radius: .25rem;
background: var(--slp-card); color: inherit; font: inherit; font-size: .85rem; cursor: pointer; }
.slp-btn[data-variant='brand'] { background: var(--slp-blue); border-color: var(--slp-blue); color: #FFFFFF; font-weight: 600; }
.slp-btn[data-variant='lost'] { color: var(--slp-red); }
.slp-flip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .8rem; color: var(--slp-muted); }
.slp-won { display: flex; align-items: center; padding: .55rem .75rem; border-radius: .25rem;
background: color-mix(in srgb, var(--slp-green) 12%, var(--slp-card)); color: var(--slp-green);
font-size: .85rem; font-weight: 600; }
.slp-hint { margin: 0; font-size: .78rem; color: var(--slp-muted); }
`;
<!-- SalesPath.vue — the Lightning Path: marketing-coloured chevrons, the
coaching "next step" field and the Mark-Stage-as-Complete CTA. Markup
mirrors the playground partial (slp-* classes). -->
<script setup lang="ts">
import { ref } from 'vue';
const stages = [
{ label: 'Prospecting', color: '#0176D3' },
{ label: 'Qualification', color: '#0B827C' },
{ label: 'Needs Analysis', color: '#6739B7' },
{ label: 'Value Proposition', color: '#FE9339' },
{ label: 'Id. Decision Makers', color: '#B32D69' },
{ label: 'Proposal/Price Quote', color: '#FFB75D' },
{ label: 'Negotiation/Review', color: '#BA0517' },
{ label: 'Closed Won', color: '#04844B' },
];
// cur is the current stage; lost drops the whole deal to Closed Lost.
const cur = ref(5);
const lost = ref(false);
const status = (i: number) =>
lost.value ? (i < cur.value ? 'complete' : 'lost')
: i < cur.value ? 'complete' : i === cur.value ? 'current' : 'incomplete';
const advance = () => { if (cur.value < stages.length - 1) cur.value++; };
const lose = () => { lost.value = true; cur.value = stages.length - 2; };
const revive = () => { lost.value = false; cur.value = 5; };
</script>
<template>
<div class="slp-root">
<div class="slp-card">
<div class="slp-what">
<small>Opportunity · Bosporus Logistics (Istanbul)</small>
<b>Nabu annual license — renewal</b>
</div>
<ol class="slp-rail">
<li v-for="(s, i) in stages" :key="s.label">
<button type="button" class="slp-step"
:style="{ '--slp-stage': s.color }"
:data-status="status(i)"
:aria-current="i === cur && !lost ? 'step' : undefined"
@click="i < cur && !lost && (cur = i)">
{{ s.label }}
</button>
</li>
</ol>
<div v-if="!lost" class="slp-coach" :style="{ '--slp-stage': stages[cur].color }">
<label for="slp-next">Next step</label>
<input id="slp-next" type="text" placeholder="e.g. send the revised quote" />
</div>
<div class="slp-foot">
<button v-if="!lost && cur < stages.length - 1" type="button" class="slp-btn"
data-variant="brand" @click="advance">Mark Stage as Complete</button>
<span v-if="cur === stages.length - 1 && !lost" class="slp-won">✓ Won — time to invoice</span>
<span v-if="!lost && cur < stages.length - 1" class="slp-flip">Deal fell through?
<button type="button" class="slp-btn" data-variant="lost" @click="lose">Mark as Lost</button>
</span>
<span v-if="lost" class="slp-flip">Reopen the deal:
<button type="button" class="slp-btn" @click="revive">Back to Proposal</button>
</span>
</div>
<p class="slp-hint">Stage {{ cur + 1 }} of {{ stages.length }} — {{ stages[cur].label }}</p>
</div>
</div>
</template>
<style scoped>
.slp-root { font-family: 'Salesforce Sans', -apple-system, 'Segoe UI', Roboto, sans-serif; color: #181818;
--slp-border: #DDDBDA; --slp-card: #FFFFFF; --slp-step-bg: #E8E8E8; --slp-step-ink: #3E3E3C;
--slp-blue: #0176D3; --slp-red: #BA0517; --slp-green: #04844B; --slp-muted: #706E6B; }
@media (prefers-color-scheme: dark) { .slp-root { color: #F3F3F3;
--slp-border: #474747; --slp-card: #232323; --slp-step-bg: #3B3B3B; --slp-step-ink: #D5D5D5;
--slp-blue: #0D9DDA; --slp-red: #FE5C4C; --slp-green: #0E9E5B; --slp-muted: #A5A5A5; } }
.slp-card { max-inline-size: 46rem; margin-inline: auto; padding: 1rem; border: 1px solid var(--slp-border);
border-radius: .25rem; background: var(--slp-card); display: grid; gap: 1rem; }
.slp-what { display: grid; gap: .15rem; }
.slp-what small { font-size: .78rem; color: var(--slp-muted); }
.slp-what b { font-size: 1.1rem; }
.slp-rail { display: flex; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.slp-rail li { display: contents; }
.slp-step { flex: 1; min-inline-size: 8.5rem; block-size: 2.6rem; padding-inline: 1.55rem; border: 0;
cursor: pointer; text-align: start; font-size: .78rem; font-weight: 600; line-height: 1.15;
background: var(--slp-step-bg); color: var(--slp-step-ink);
clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.slp-step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.slp-step[data-status='complete'], .slp-step[data-status='current'] { background: var(--slp-stage); color: #FFFFFF; }
.slp-step[data-status='current'] { font-weight: 700; }
.slp-step[data-status='lost'] { background: var(--slp-red); color: #FFFFFF; }
.slp-coach { display: grid; gap: .35rem; padding: .75rem; border: 1px solid var(--slp-border);
border-block-start: 2px solid var(--slp-stage); }
.slp-coach label { font-size: .72rem; font-weight: 700; color: var(--slp-muted); }
.slp-coach input { padding: .4rem .55rem; border: 1px solid var(--slp-border); border-radius: .25rem;
background: var(--slp-card); color: inherit; font: inherit; font-size: .85rem; }
.slp-foot { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.slp-btn { padding: .45rem 1rem; border: 1px solid var(--slp-border); border-radius: .25rem;
background: var(--slp-card); color: inherit; font: inherit; font-size: .85rem; cursor: pointer; }
.slp-btn[data-variant='brand'] { background: var(--slp-blue); border-color: var(--slp-blue); color: #FFFFFF; font-weight: 600; }
.slp-btn[data-variant='lost'] { color: var(--slp-red); }
.slp-flip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .8rem; color: var(--slp-muted); }
.slp-won { display: flex; align-items: center; padding: .55rem .75rem; border-radius: .25rem;
background: color-mix(in srgb, var(--slp-green) 12%, var(--slp-card)); color: var(--slp-green);
font-size: .85rem; font-weight: 600; }
.slp-hint { margin: 0; font-size: .78rem; color: var(--slp-muted); }
</style>
<!-- SalesPath.svelte — the Lightning Path: marketing-coloured chevrons, the
coaching "next step" field and the Mark-Stage-as-Complete CTA. Markup
mirrors the playground partial (slp-* classes). -->
<script lang="ts">
const stages = [
{ label: 'Prospecting', color: '#0176D3' },
{ label: 'Qualification', color: '#0B827C' },
{ label: 'Needs Analysis', color: '#6739B7' },
{ label: 'Value Proposition', color: '#FE9339' },
{ label: 'Id. Decision Makers', color: '#B32D69' },
{ label: 'Proposal/Price Quote', color: '#FFB75D' },
{ label: 'Negotiation/Review', color: '#BA0517' },
{ label: 'Closed Won', color: '#04844B' },
];
// cur is the current stage; lost drops the whole deal to Closed Lost.
let cur = $state(5);
let lost = $state(false);
const status = (i: number) =>
lost ? (i < cur ? 'complete' : 'lost')
: i < cur ? 'complete' : i === cur ? 'current' : 'incomplete';
const advance = () => { if (cur < stages.length - 1) cur++; };
const lose = () => { lost = true; cur = stages.length - 2; };
const revive = () => { lost = false; cur = 5; };
</script>
<div class="slp-root">
<div class="slp-card">
<div class="slp-what">
<small>Opportunity · Bosporus Logistics (Istanbul)</small>
<b>Nabu annual license — renewal</b>
</div>
<ol class="slp-rail">
{#each stages as s, i (s.label)}
<li>
<button
type="button"
class="slp-step"
style:--slp-stage={s.color}
data-status={status(i)}
aria-current={i === cur && !lost ? 'step' : undefined}
onclick={() => { if (i < cur && !lost) cur = i; }}
>
{s.label}
</button>
</li>
{/each}
</ol>
{#if !lost}
<div class="slp-coach" style:--slp-stage={stages[cur].color}>
<label for="slp-next">Next step</label>
<input id="slp-next" type="text" placeholder="e.g. send the revised quote" />
</div>
{/if}
<div class="slp-foot">
{#if !lost && cur < stages.length - 1}
<button type="button" class="slp-btn" data-variant="brand" onclick={advance}>
Mark Stage as Complete
</button>
{/if}
{#if cur === stages.length - 1 && !lost}
<span class="slp-won">✓ Won — time to invoice</span>
{/if}
{#if lost}
<span class="slp-flip">Reopen the deal:
<button type="button" class="slp-btn" onclick={revive}>Back to Proposal</button>
</span>
{:else}
<span class="slp-flip">Deal fell through?
<button type="button" class="slp-btn" data-variant="lost" onclick={lose}>Mark as Lost</button>
</span>
{/if}
</div>
<p class="slp-hint">Stage {cur + 1} of {stages.length} — {stages[cur].label}</p>
</div>
</div>
<style>
.slp-root { font-family: 'Salesforce Sans', -apple-system, 'Segoe UI', Roboto, sans-serif; color: #181818;
--slp-border: #DDDBDA; --slp-card: #FFFFFF; --slp-step-bg: #E8E8E8; --slp-step-ink: #3E3E3C;
--slp-blue: #0176D3; --slp-red: #BA0517; --slp-green: #04844B; --slp-muted: #706E6B; }
@media (prefers-color-scheme: dark) { .slp-root { color: #F3F3F3;
--slp-border: #474747; --slp-card: #232323; --slp-step-bg: #3B3B3B; --slp-step-ink: #D5D5D5;
--slp-blue: #0D9DDA; --slp-red: #FE5C4C; --slp-green: #0E9E5B; --slp-muted: #A5A5A5; } }
.slp-card { max-inline-size: 46rem; margin-inline: auto; padding: 1rem; border: 1px solid var(--slp-border);
border-radius: .25rem; background: var(--slp-card); display: grid; gap: 1rem; }
.slp-what { display: grid; gap: .15rem; }
.slp-what small { font-size: .78rem; color: var(--slp-muted); }
.slp-what b { font-size: 1.1rem; }
.slp-rail { display: flex; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.slp-rail li { display: contents; }
.slp-step { flex: 1; min-inline-size: 8.5rem; block-size: 2.6rem; padding-inline: 1.55rem; border: 0;
cursor: pointer; text-align: start; font-size: .78rem; font-weight: 600; line-height: 1.15;
background: var(--slp-step-bg); color: var(--slp-step-ink);
clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.slp-step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.slp-step[data-status='complete'], .slp-step[data-status='current'] { background: var(--slp-stage); color: #FFFFFF; }
.slp-step[data-status='current'] { font-weight: 700; }
.slp-step[data-status='lost'] { background: var(--slp-red); color: #FFFFFF; }
.slp-coach { display: grid; gap: .35rem; padding: .75rem; border: 1px solid var(--slp-border);
border-block-start: 2px solid var(--slp-stage); }
.slp-coach label { font-size: .72rem; font-weight: 700; color: var(--slp-muted); }
.slp-coach input { padding: .4rem .55rem; border: 1px solid var(--slp-border); border-radius: .25rem;
background: var(--slp-card); color: inherit; font: inherit; font-size: .85rem; }
.slp-foot { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.slp-btn { padding: .45rem 1rem; border: 1px solid var(--slp-border); border-radius: .25rem;
background: var(--slp-card); color: inherit; font: inherit; font-size: .85rem; cursor: pointer; }
.slp-btn[data-variant='brand'] { background: var(--slp-blue); border-color: var(--slp-blue); color: #FFFFFF; font-weight: 600; }
.slp-btn[data-variant='lost'] { color: var(--slp-red); }
.slp-flip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .8rem; color: var(--slp-muted); }
.slp-won { display: flex; align-items: center; padding: .55rem .75rem; border-radius: .25rem;
background: color-mix(in srgb, var(--slp-green) 12%, var(--slp-card)); color: var(--slp-green);
font-size: .85rem; font-weight: 600; }
.slp-hint { margin: 0; font-size: .78rem; color: var(--slp-muted); }
</style>