Skip to content

Commit d16ccdb

Browse files
fix (Amount): add default value (#451)
feat: add default value as 0
1 parent 2bcd59e commit d16ccdb

File tree

2 files changed

+3
-1
lines changed
  • apps/www/src/content/docs/components/amount
  • packages/raystack/components/amount

2 files changed

+3
-1
lines changed

apps/www/src/content/docs/components/amount/props.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export interface AmountProps {
22
/**
33
* The monetary value to display
4+
* @default 0
45
* @example
56
* valueInMinorUnits=true: 1299 => "$12.99"
67
* valueInMinorUnits=false: 12.99 => "$12.99"

packages/raystack/components/amount/amount.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
33
export interface AmountProps {
44
/**
55
* The monetary value to display
6+
* @default 0
67
* @example
78
* valueInMinorUnits=true: 1299 => "$12.99"
89
* valueInMinorUnits=false: 12.99 => "$12.99"
@@ -142,7 +143,7 @@ function isValidCurrency(currency: string): boolean {
142143
export const Amount = forwardRef<HTMLSpanElement, AmountProps>(
143144
(
144145
{
145-
value,
146+
value = 0,
146147
currency = 'USD',
147148
locale = 'en-US',
148149
hideDecimals = false,

0 commit comments

Comments
 (0)