diff --git a/lib/components/Select/Select.test.tsx b/lib/components/Select/Select.test.tsx index 97c8c0a0..1b0229a9 100644 --- a/lib/components/Select/Select.test.tsx +++ b/lib/components/Select/Select.test.tsx @@ -177,6 +177,14 @@ describe('Select', () => { expect(option).toBeInTheDocument(); }); + + it('should render the labelAction next to the label', () => { + setup({ + labelAction: , + }); + + expect(screen.getByText('Action')).toBeInTheDocument(); + }); }); describe('select inside a form', () => { diff --git a/lib/components/Select/Select.types.ts b/lib/components/Select/Select.types.ts index 6e29159e..acc923ec 100644 --- a/lib/components/Select/Select.types.ts +++ b/lib/components/Select/Select.types.ts @@ -88,6 +88,7 @@ export type SelectProps = VariantProps & isLoading?: boolean; isRequired?: boolean; label?: string; + labelAction?: ReactNode; labelClassName?: string; labelWrapperClassName?: string; listClassName?: string; diff --git a/lib/components/Select/components/Wrapper.tsx b/lib/components/Select/components/Wrapper.tsx index e23ff24e..750647fb 100644 --- a/lib/components/Select/components/Wrapper.tsx +++ b/lib/components/Select/components/Wrapper.tsx @@ -46,6 +46,7 @@ export const Wrapper: ForwardRefExoticComponent< isLoading, isRequired, label, + labelAction, labelClassName, labelWrapperClassName, listClassName, @@ -135,7 +136,12 @@ export const Wrapper: ForwardRefExoticComponent< data-theme={theme} > {label ? ( -
+
+ {labelAction}
) : null}