fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Support custom search icons in SearchBox

Open prabhatmuroor opened this issue 8 years ago • 5 comments

Bug Report

  • Package version(s): 5.106.1002
  • Browser and OS versions: Chrome/All

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? Yes

Requested priority: High

Describe the issue:

Office fabric searchbox, lets us change the icon, by ISearchBoxStyles here: https://developer.microsoft.com/en-us/fabric#/components/searchbox#Variants

But icon has been hardcoded here: https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/office-ui-fabric-react/src/components/SearchBox/SearchBox.base.tsx line 81..

Actual behavior:

Overriding style for SearchBox doesnt work

Expected behavior:

Overriding style for SearchBox should work

prabhatmuroor avatar Jun 11 '18 06:06 prabhatmuroor

@prabhatmuroor Thanks for offering to open a PR. Please do so.

michaelangotti avatar Jun 14 '18 17:06 michaelangotti

@prabhatmuroor what are you trying to do to the search icon that you cannot do?

https://codepen.io/micahgodbolt/pen/jvqgMm?editors=1010

micahgodbolt avatar Aug 27 '18 20:08 micahgodbolt

@micahgodbolt I'm not the original author of the issue, but the missing behavior that I see is the ability to specify a different icon to be rendered. Some other Fabric components accept iconProps where you can specify which icon will be used, not just the styles to be applied to the icon.

This could be a by-design issue though, if you don't want to allow the Searchbox Component to render a different icon than what it does currently.

dcowen91 avatar Aug 27 '18 21:08 dcowen91

I'd like to be able to use a different icon (the Filter one specifically) will you take a PR for this? If so, what approach is preferred:

  1. Exposing an enum property searchIcon of type enum SearchBoxIcon { search, filter }
  2. Adding a searchIconName?: string property.
  3. Adding a searchIconProps?: IIconProps property (this would be more inline with what is done for the clearButtonProps property.
  4. Something else?

redoz avatar Aug 31 '18 15:08 redoz

yeah, that's a valid ask. A single prop for iconProps?: IIconProps would allow people to cheaply tweak the icon without a full onRender.

I'm good with that. just go iconProps, as calling it 'search' kinda indicates that it's always search icon

micahgodbolt avatar Aug 31 '18 16:08 micahgodbolt