Files
web/packages/design-system/lib/components/Form/FormSelect/index.tsx
Matilda Landström 9ad9e374e8 Merged in fix/LOY-398-fix-language-select (pull request #3227)
fix(LOY-398): fix language select by creating FormSelect wrapper

* fix(LOY-398): fix language select by creating FormSelect wrapper


Approved-by: Erik Tiekstra
Approved-by: Anton Gunnarsson
2025-11-27 12:06:46 +00:00

26 lines
554 B
TypeScript

'use client'
import { useController } from 'react-hook-form'
import { Select } from '../../Select'
import { SelectProps } from '../../Select/types'
export function FormSelect({ label, items, name }: SelectProps) {
const { field, fieldState } = useController({
name,
})
return (
<Select
items={items}
label={label}
isInvalid={fieldState.invalid}
name={name}
onBlur={field.onBlur}
onSelectionChange={(c) => field.onChange(c ?? '')}
selectedKey={field.value}
data-testid={name}
/>
)
}