diff --git a/src/NumberWithUnit/NumberWithUnit.jsx b/src/NumberWithUnit/NumberWithUnit.jsx index 2745f928d010fb860799aebec9df3fd00699571e..b4853afdd19f431804f6c3d4f863756b50d292a4 100644 --- a/src/NumberWithUnit/NumberWithUnit.jsx +++ b/src/NumberWithUnit/NumberWithUnit.jsx @@ -4,7 +4,13 @@ import {useState} from "react"; export default function NumberWithUnit({label, onChange, value, className}) { const splitValues = function (fontSize) { + + if( !fontSize ) { + return {size: "0", unit: "px"}; + } + const match = fontSize.match(/^(\d+)([a-z%]+)$/i); + if (!match) { return {size: "16", unit: "px"}; }