summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Select
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-02-22 10:14:32 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-02-22 10:14:32 +0700
commit3c559031623649a67825ff47f34512f0eb946861 (patch)
tree7b62faeebaf3e344cf01ba1c9ced03c7a4fcaf23 /src/core/components/elements/Select
parent50f5a2d8897020acc11f2a20469ffdd42ca7c31b (diff)
fix
Diffstat (limited to 'src/core/components/elements/Select')
-rw-r--r--src/core/components/elements/Select/HookFormSelect.jsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/components/elements/Select/HookFormSelect.jsx b/src/core/components/elements/Select/HookFormSelect.jsx
new file mode 100644
index 00000000..45cd89b6
--- /dev/null
+++ b/src/core/components/elements/Select/HookFormSelect.jsx
@@ -0,0 +1,17 @@
+import ReactSelect from "react-select"
+
+const HookFormSelect = ({
+ field,
+ ...props
+}) => (
+ <ReactSelect
+ classNamePrefix="form-select"
+ ref={field.ref}
+ onChange={(option) => field.onChange(option.value)}
+ value={field.value ? props.options.find(option => option.value === field.value) : ''}
+ isDisabled={props.disabled}
+ {...props}
+ />
+)
+
+export default HookFormSelect \ No newline at end of file