Skip to content

Commit 66021a8

Browse files
juliajforestidougfabristassoevan
authored
feat(fuselage): Add custom Icon to Select Component (#639)
* Add addonIcon prop to Select * improve: prevent list to open clicking on addon * chore: remove fluted code Co-authored-by: dougfabris <devfabris@gmail.com> Co-authored-by: Tasso Evangelista <tasso.evangelista@rocket.chat>
1 parent 18464ce commit 66021a8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/fuselage/src/components/Select/Select.stories.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ WithEmptyOptions.args = {
100100
options: [],
101101
};
102102

103+
export const WithAddon: ComponentStory<typeof Select> = TemplateWithFilter.bind(
104+
{}
105+
);
106+
WithAddon.args = {
107+
width: '250px',
108+
placeholder: 'Placeholder here...',
109+
options,
110+
addonIcon: 'magnifier',
111+
};
112+
103113
export const CustomEmpty: ComponentStory<typeof Select> =
104114
TemplateWithFilter.bind({});
105115
CustomEmpty.args = {

packages/fuselage/src/components/Select/Select.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export type SelectProps = Omit<ComponentProps<typeof Box>, 'onChange'> & {
7373
filter?: string;
7474
renderOptions?: ElementType;
7575
customEmpty?: string;
76+
addonIcon?: ComponentProps<typeof Icon>['name'];
7677
};
7778

7879
export const Select = forwardRef(
@@ -89,6 +90,7 @@ export const Select = forwardRef(
8990
getLabel = ([_, label] = ['', '']) => label,
9091
placeholder = '',
9192
renderOptions: _Options = Options,
93+
addonIcon,
9294
customEmpty,
9395
...props
9496
}: SelectProps,
@@ -201,7 +203,7 @@ export const Select = forwardRef(
201203
name={
202204
visible === AnimatedVisibility.VISIBLE
203205
? 'cross'
204-
: 'chevron-down'
206+
: addonIcon || 'chevron-down'
205207
}
206208
size='x20'
207209
/>

0 commit comments

Comments
 (0)