nyuchimzizi
Mzizi — an open-architecture project of the Bundu Foundation, operated and developed by Nyuchi. Built on the Five African Minerals palette.
Built by Nyuchi Africav4.0.39
Route fare display with breakdown by segment, applicable discounts, and total. Supports multi-currency display. Used in Transport for route cost estimation before booking.
No interactive demo is registered for this component yet — the source is shown directly.
import * as React from "react"
import { cn } from "@/lib/utils"
interface FareSegment {
label: string
amount: number
}
interface FareCalculatorProps extends React.ComponentProps<"div"> {
segments: FareSegment[]
currency?: string
discount?: { label: string; amount: number }
total?: number
}
function FareCalculator({ segments, currency = "MXT", discount, total, loading = false, className, ...props }: FareCalculatorProps) {
const computedTotal = total ?? segments.reduce((sum, s) => sum + s.amount, 0) - (discount?.amount ?? 0)
return (
<div
data-slot="fare-calculator" data-portal="https://design.nyuchi.com/components/fare-calculator" role="article"
className={cn("rounded-[var(--radius-lg,14px)] border border-border bg-card p-4", className)}
{...props}
>
<div className="text-xs font-medium text-muted-foreground">Fare breakdown</div>
<div className="mt-2 space-y-1.5">
{segments.map((seg, i) => (
<div key={i} className="flex items-center justify-between text-sm">
<span className="text-muted-foreground">{seg.label}</span>
<span className="tabular-nums">{seg.amount.toFixed(2)} {currency}</span>
</div>
))}
{discount && (
<div className="flex items-center justify-between text-sm text-[var(--color-malachite,#64FFDA)]">
<span>{discount.label}</span>
<span className="tabular-nums">-{discount.amount.toFixed(2)} {currency}</span>
</div>
)}
</div>
<div className="mt-3 flex items-center justify-between border-t border-border pt-3">
<span className="text-sm font-medium">Total</span>
<span className="text-base font-bold tabular-nums">{computedTotal.toFixed(2)} {currency}</span>
</div>
</div>
)
}
export { FareCalculator }
export type { FareCalculatorProps }
The variants, sizes, and props surfaced by the registry. Each is sourced from the Supabase component_docs table.
Hit the registry API live and see the JSON the shadcn CLI consumes when it installs this component.
/api/v1/ui/fare-calculatornpx shadcn@latest add https://mzizi.dev/api/v1/ui/fare-calculator