diff --git a/src/components/Select.tsx b/src/components/Select.tsx index fd2d7b0..09b6b9e 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -108,6 +108,7 @@ interface SelectProps { value?: Option['value']; defaultValue?: Option['value']; disabled?: boolean; + readonly?: boolean; onChange?: (value: Option['value']) => void; } @@ -118,6 +119,7 @@ const Select: Component = (props) => { placeholder: '', options: [], disabled: false, + readonly: false, }, props, ); @@ -209,7 +211,9 @@ const Select: Component = (props) => { return; } clearTimeout(hideOptionTimer); - setOptionVisible((prev) => !prev); + if (!mProps.readonly) { + setOptionVisible((prev) => !prev); + } }; const handleOptionClick = (value: Option['value']) => { if (selected() !== value) { @@ -228,8 +232,9 @@ const Select: Component = (props) => {