app-ui / navigation / progress-bars
Circles With Text
07-circles-with-text.jsx
import { CheckIcon } from '@heroicons/react/20/solid'
const steps = [
{ name: 'Create account', description: 'Vitae sed mi luctus laoreet.', href: '#', status: 'complete' },
{
name: 'Profile information',
description: 'Cursus semper viverra facilisis et et some more.',
href: '#',
status: 'current',
},
{ name: 'Business information', description: 'Penatibus eu quis ante.', href: '#', status: 'upcoming' },
{ name: 'Theme', description: 'Faucibus nec enim leo et.', href: '#', status: 'upcoming' },
{ name: 'Preview', description: 'Iusto et officia maiores porro ad non quas.', href: '#', status: 'upcoming' },
]
function classNames(...classes) {
return classes.filter(Boolean).join(' ')
}
export default function Example() {
return (
<nav aria-label="Progress">
<ol role="list" className="overflow-hidden">
{steps.map((step, stepIdx) => (
<li key={step.name} className={classNames(stepIdx !== steps.length - 1 ? 'pb-10' : '', 'relative')}>
{step.status === 'complete' ? (
<>
{stepIdx !== steps.length - 1 ? (
<div
aria-hidden="true"
className="absolute top-4 left-4 mt-0.5 -ml-px h-full w-0.5 bg-indigo-600 dark:bg-indigo-500"
/>
) : null}
<a href={step.href} className="group relative flex items-start">
<span className="flex h-9 items-center">
<span className="relative z-10 flex size-8 items-center justify-center rounded-full bg-indigo-600 group-hover:bg-indigo-800 dark:bg-indigo-500 dark:group-hover:bg-indigo-600">
<CheckIcon aria-hidden="true" className="size-5 text-white" />
</span>
</span>
<span className="ml-4 flex min-w-0 flex-col">
<span className="text-sm font-medium text-gray-900 dark:text-white">{step.name}</span>
<span className="text-sm text-gray-500 dark:text-gray-400">{step.description}</span>
</span>
</a>
</>
) : step.status === 'current' ? (
<>
{stepIdx !== steps.length - 1 ? (
<div
aria-hidden="true"
className="absolute top-4 left-4 mt-0.5 -ml-px h-full w-0.5 bg-gray-300 dark:bg-gray-700"
/>
) : null}
<a href={step.href} aria-current="step" className="group relative flex items-start">
<span aria-hidden="true" className="flex h-9 items-center">
<span className="relative z-10 flex size-8 items-center justify-center rounded-full border-2 border-indigo-600 bg-white dark:border-indigo-500 dark:bg-gray-900">
<span className="size-2.5 rounded-full bg-indigo-600 dark:bg-indigo-500" />
</span>
</span>
<span className="ml-4 flex min-w-0 flex-col">
<span className="text-sm font-medium text-indigo-600 dark:text-indigo-400">{step.name}</span>
<span className="text-sm text-gray-500 dark:text-gray-400">{step.description}</span>
</span>
</a>
</>
) : (
<>
{stepIdx !== steps.length - 1 ? (
<div
aria-hidden="true"
className="absolute top-4 left-4 mt-0.5 -ml-px h-full w-0.5 bg-gray-300 dark:bg-white/15"
/>
) : null}
<a href={step.href} className="group relative flex items-start">
<span aria-hidden="true" className="flex h-9 items-center">
<span className="relative z-10 flex size-8 items-center justify-center rounded-full border-2 border-gray-300 bg-white group-hover:border-gray-400 dark:border-white/15 dark:bg-gray-900 dark:group-hover:border-white/25">
<span className="size-2.5 rounded-full bg-transparent group-hover:bg-gray-300 dark:group-hover:bg-white/15" />
</span>
</span>
<span className="ml-4 flex min-w-0 flex-col">
<span className="text-sm font-medium text-gray-500 dark:text-gray-400">{step.name}</span>
<span className="text-sm text-gray-500 dark:text-gray-400">{step.description}</span>
</span>
</a>
</>
)}
</li>
))}
</ol>
</nav>
)
}