A multi-step component for displaying progress through a sequence of logical and numbered steps.
Your basic information
Select your preferred time
Review and confirm
npm install @ark-ui/react'use client'
import { Steps } from '@ark-ui/react/steps'
import { type Assign, type WithFixedClassName, createStyleContext } from '@pallas-ui/style-context'
import * as React from 'react'
import { steps } from '@styled-system/recipes'
import type { ComponentProps, JsxStyleProps } from '@styled-system/types'
const { withProvider, withContext } = createStyleContext(steps)
export type RootProps = WithFixedClassName<ComponentProps<typeof Steps.Root>> & {
size?: 'sm' | 'md' | 'lg'
}
export const Root = withProvider<
React.ComponentRef<typeof Steps.Root>,
Assign<RootProps, JsxStyleProps>
>(Steps.Root, 'root')
export const Trigger = withContext<
React.ComponentRef<typeof Steps.Trigger>,
Assign<ComponentProps<typeof Steps.Trigger>, JsxStyleProps>
>(Steps.Trigger, 'trigger')
const Content = withContext<
React.ComponentRef<typeof Steps.Content>,
Assign<ComponentProps<typeof Steps.Content>, JsxStyleProps>
>(Steps.Content, 'stepContent')
const List = withContext<
React.ComponentRef<typeof Steps.List>,
Assign<ComponentProps<typeof Steps.List>, JsxStyleProps>
>(Steps.List, 'list')
const Item = withContext<
React.ComponentRef<typeof Steps.Item>,
Assign<ComponentProps<typeof Steps.Item>, JsxStyleProps>
>(Steps.Item, 'item')
export type IndicatorProps = Assign<ComponentProps<typeof Steps.Indicator>, JsxStyleProps> & {
loading?: boolean
disabled?: boolean
}
const BaseIndicator = withContext<
React.ComponentRef<typeof Steps.Indicator>,
Assign<ComponentProps<typeof Steps.Indicator>, JsxStyleProps>
>(Steps.Indicator, 'indicator')
const Indicator = React.forwardRef<React.ComponentRef<typeof Steps.Indicator>, IndicatorProps>(
({ loading, disabled, ...props }, ref) => {
return (
<BaseIndicator
{...props}
ref={ref}
data-loading={loading || undefined}
data-disabled={disabled || undefined}
/>
)
},
)
Indicator.displayName = 'Steps.Indicator'
const Separator = withContext<
React.ComponentRef<typeof Steps.Separator>,
Assign<ComponentProps<typeof Steps.Separator>, JsxStyleProps>
>(Steps.Separator, 'separator')
const Dialog = {
Root,
Trigger,
Content,
List,
Item,
Indicator,
Separator,
}
export default Dialogimport Steps from '@/components/ui/steps'<Steps.Root count={3} orientation="horizontal" size="md">
<Steps.List>
<Steps.Item index={0}>
<Steps.Trigger>
<Steps.Indicator>1</Steps.Indicator>
<span>First Step</span>
</Steps.Trigger>
<Steps.Separator />
</Steps.Item>
<Steps.Item index={1}>
<Steps.Trigger>
<Steps.Indicator>2</Steps.Indicator>
<span>Second Step</span>
</Steps.Trigger>
<Steps.Separator />
</Steps.Item>
<Steps.Item index={2}>
<Steps.Trigger>
<Steps.Indicator>3</Steps.Indicator>
<span>Third Step</span>
</Steps.Trigger>
<Steps.Separator />
</Steps.Item>
</Steps.List>
<Steps.Content index={0}>
First step content
</Steps.Content>
<Steps.Content index={1}>
Second step content
</Steps.Content>
<Steps.Content index={2}>
Third step content
</Steps.Content>
</Steps.Root>Your basic information
Select your preferred time
Review and confirm
Enter your personal details
Choose your preferred schedule
Complete your payment information
Review and confirm your booking
Create your account and verify email
Complete your profile information
Verify your identity
Your account is ready to use
The Steps component supports a loading state for individual step indicators. Use the loading prop on Steps.Indicator to show a loading animation:
<Steps.Indicator loading={true}>
<span>1</span>
</Steps.Indicator>Enter your name and email
Set your account preferences
Verify your account
This step is currently disabled
Account setup complete
This step is currently disabled
Individual step indicators can be disabled using the disabled prop. Disabled steps are visually dimmed and cannot be interacted with:
<Steps.Indicator disabled={true}>
<span>1</span>
</Steps.Indicator>