UIPackage React Native
Search
Menu

Order Confirmation

A confirmed order reference and next step with optional receipt and tracking actions.

Install

First install? Set up the registry in your app.

npx --yes --package=https://native.uipkge.dev/cli/uipkge-native-0.1.1.tgz uipkge-native add order-confirmation

Source files

Expand a file to read the source the installer copies into your app.

components/blocks/order-confirmation/OrderConfirmation.tsx
import { View, type ViewProps } from 'react-native'
import { Check } from 'lucide-react-native'
import { Button } from '@/components/ui/button'
import { Icon } from '@/components/ui/icon'
import { Text } from '@/components/ui/text'
import { cn } from '@/lib/utils'

export interface OrderConfirmationProps extends Omit<ViewProps, 'children'> {
  className?: string
  title?: string
  /** Visible order reference from the confirmed order. */
  reference: string
  nextStep?: string
  /** Caller-localized handoff timing or an explicitly estimated delivery range. */
  timing?: string
  onViewReceipt?: () => void
  onTrackOrder?: () => void
  labels?: Partial<Record<'reference' | 'next' | 'receipt' | 'track', string>>
}

export function OrderConfirmation({
  className,
  title = 'Order confirmed',
  reference,
  nextStep,
  timing,
  onViewReceipt,
  onTrackOrder,
  labels,
  ...props
}: OrderConfirmationProps) {
  const track = labels?.track ?? 'Track order'
  const receipt = labels?.receipt ?? 'View receipt'

  return (
    <View {...props} className={cn('gap-[16px] rounded-lg border border-border bg-card p-[16px]', className)}>
      <View className="flex-row items-center gap-[12px]">
        <View aria-hidden className="size-[40px] shrink-0 items-center justify-center rounded-full bg-muted">
          <Icon icon={Check} size={22} className="text-card-foreground" />
        </View>
        <Text size="title" accessibilityRole="header" className="min-w-0 flex-1 text-card-foreground">
          {title}
        </Text>
      </View>
      <View className="gap-[4px]">
        <Text size="sm" variant="muted">
          {labels?.reference ?? 'Order reference'}
        </Text>
        <Text selectable className="font-semibold text-card-foreground">
          {reference}
        </Text>
      </View>
      {nextStep || timing ? (
        <View className="gap-[4px] border-t border-border pt-[16px]">
          <Text size="sm" variant="muted">
            {labels?.next ?? 'What happens next'}
          </Text>
          {nextStep ? <Text className="text-card-foreground">{nextStep}</Text> : null}
          {timing ? (
            <Text size="sm" className="font-medium text-card-foreground">
              {timing}
            </Text>
          ) : null}
        </View>
      ) : null}
      {onViewReceipt || onTrackOrder ? (
        <View className="gap-[8px]">
          {onTrackOrder ? (
            <Button accessibilityLabel={track} onPress={onTrackOrder}>
              {track}
            </Button>
          ) : null}
          {onViewReceipt ? (
            <Button variant="outline" accessibilityLabel={receipt} onPress={onViewReceipt}>
              {receipt}
            </Button>
          ) : null}
        </View>
      ) : null}
    </View>
  )
}
components/blocks/order-confirmation/index.ts
export { OrderConfirmation, type OrderConfirmationProps } from './OrderConfirmation'

Dependencies

Registry items

npm packages

  • lucide-react-native
Browse shopping and reservations