diff --git a/packages/design-system/src/forms/FormikNumberField.tsx b/packages/design-system/src/forms/FormikNumberField.tsx
index e343804..d924526 100644
--- a/packages/design-system/src/forms/FormikNumberField.tsx
+++ b/packages/design-system/src/forms/FormikNumberField.tsx
@@ -11,6 +11,7 @@ interface FormikNumberFieldProps {
precision?: number
min?: number
max?: number
+ unit?: string
tooltip?: string | React.ReactNode
required?: boolean
hideError?: boolean
@@ -51,6 +52,7 @@ export interface FormikNumberFieldOnChangeProps extends FormikNumberFieldProps {
* @param precision - The optional precision defines the number of decimal places that are allowed.
* @param min - The optional min defines the minimum value that is allowed.
* @param max - The optional max defines the maximum value that is allowed.
+ * @param unit - The optional unit is shown next to the input field.
* @param tooltip - The optional tooltip is shown on hover over the tooltip next to the label.
* @param required - Indicate whether the field is required or not.
* @param hideError - Indicate whether the error message should be hidden or not.
@@ -72,6 +74,7 @@ export function FormikNumberField({
precision,
min,
max,
+ unit,
tooltip,
required,
hideError,
@@ -98,6 +101,7 @@ export function FormikNumberField({
precision={precision}
min={min}
max={max}
+ unit={unit}
tooltip={tooltip}
required={required}
hideError={hideError}
@@ -128,6 +132,7 @@ export function FormikNumberField({
precision={precision}
min={min}
max={max}
+ unit={unit}
tooltip={tooltip}
required={required}
hideError={hideError}
diff --git a/packages/design-system/src/forms/NumberField.stories.tsx b/packages/design-system/src/forms/NumberField.stories.tsx
index 84f86f5..7a9dc14 100644
--- a/packages/design-system/src/forms/NumberField.stories.tsx
+++ b/packages/design-system/src/forms/NumberField.stories.tsx
@@ -35,6 +35,29 @@ export function Placeholder() {
)
}
+export function Unit() {
+ const [value, setValue] = useState('')
+ return (
+
+ )
+}
+
export function Precision() {
const [value, setValue] = useState('')
return (
diff --git a/packages/design-system/src/forms/NumberField.tsx b/packages/design-system/src/forms/NumberField.tsx
index faed0c2..5accadb 100644
--- a/packages/design-system/src/forms/NumberField.tsx
+++ b/packages/design-system/src/forms/NumberField.tsx
@@ -9,6 +9,7 @@ export interface NumberFieldClassName {
field?: string
label?: string
input?: string
+ unit?: string
error?: string
tooltip?: string
}
@@ -23,6 +24,7 @@ export interface NumberFieldProps {
precision?: number
min?: number
max?: number
+ unit?: string
tooltip?: string | React.ReactNode
required?: boolean
hideError?: boolean
@@ -50,6 +52,7 @@ export interface NumberFieldProps {
* @param precision - The optional precision defines the number of decimal places that are allowed.
* @param min - The optional min defines the minimum value that is allowed.
* @param max - The optional max defines the maximum value that is allowed.
+ * @param unit - The optional unit is shown next to the input field.
* @param tooltip - The optional tooltip is shown on hover over the tooltip next to the label.
* @param required - Indicate whether the field is required or not.
* @param hideError - Indicate whether the error message should be hidden or not.
@@ -70,6 +73,7 @@ export function NumberField({
precision,
min,
max,
+ unit,
tooltip,
required = false,
hideError,
@@ -108,40 +112,54 @@ export function NumberField({
)}