Skip to content

Commit cf5cecd

Browse files
committed
fixed label font size for the dropdown in the forms
1 parent 7323acf commit cf5cecd

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

web/core/Select/Select.tsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
import { forwardRef } from 'react'
22
import { NativeSelect as EdsNativeSelect, NativeSelectProps } from '@equinor/eds-core-react'
3+
import { twMerge } from 'tailwind-merge'
34

4-
type SelectProps = NativeSelectProps
5+
type SelectProps = NativeSelectProps & {
6+
label?: string
7+
}
58

6-
export const Select = forwardRef<HTMLDivElement, SelectProps>(function Select({ children, ...rest }, ref) {
9+
export const Select = forwardRef<HTMLDivElement, SelectProps>(function Select({
10+
children,
11+
className = '',
12+
label,
13+
id,
14+
...rest
15+
}, ref) {
716
return (
8-
<EdsNativeSelect ref={ref} {...rest} className="[&>label]:text-base [&>label]:font-medium *:!text-slate-80">
9-
{children}
10-
</EdsNativeSelect>
17+
<div ref={ref} className={className}>
18+
{label && (
19+
<label htmlFor={id} className="mx-2 text-base font-medium">
20+
{label}
21+
</label>
22+
)}
23+
<EdsNativeSelect
24+
{...rest}
25+
id={id}
26+
className="[&_select]:text-base"
27+
label=''
28+
>
29+
{children}
30+
</EdsNativeSelect>
31+
</div>
1132
)
1233
})

0 commit comments

Comments
 (0)